Deposit would not have changed anything in this case at all.
The purpose of the deposit is to prove to the dealership that you are serious about your intention to purchase the car. It (or portions of it) can also be used to cover dealer's expenses in situation when you change your mind. It does not in any way tied to the dealer being serious about their intention to sell this car to you. I.e. the deposit works in the opposite direction from what was really needed in this case.
In this specific case (the car sold to another customer) the dealer would have to return the full deposit to you immediately, no question about it. And they would have done it, of course. But that would put you in the very same situation: no car, and no refund for the airfare.
In order to reserve the car, you'd have to have some sort of contract in place, which could be verbal (there's a proper procedure for that as well). Deposit is really irrelevant.