Meggi, something is very, very wrong here with paying $40,000 grand for a car worth $26,500.
You did have a choice.
You need to contact a lawyer and report this dealer to Mazda Canada.
There was a report in the media about a dealer that sold a $40,000 car to a client for $60,000. Amongst other trouble he got into, he can no longer sell Mazda's.
Yes, it's very embarrassing to be ripped off like that, but don't let the embarrassment separate you from $13,000.
You'll need a lawyer though. They won't listen to you and they'll keep threatening you. Do not take this lying down!