Welcome to the site!
That's terrible what the dealership did to you - however, it happens all the time. Sales people find it hard to turn away a customer with $$$. Even if the car was 'sold', if someone walks in and offers cash for it, they'll sell it every time.
Sorry to hear. I better one always comes along...
-Chike