Also remember that a $5,000 car will depreciate slower than a $15,000 car. So the odds of you recouping most of your costs (or possibly making money if you snag a deal) when you go to sell & upgrade are much better with the less expensive car. Also consider you'll pay 3x as much tax (a sunk cost) on a $15,000 car as you would on a $5,000 car.
I like to ask myself how many miles do I expect to get out of this vehicle and how much do I expect to sell it for. I generally like to get at least 20 miles (more if it's a higher mileage vehicle) out of every dollar I paid for the car. For example, my current vehicle is a 2005 Accord. It had 143,000 miles on it when I purchased it. With it being a higher mileage vehicle, my goal was to get at least 25-30 miles out of every dollar I paid for the car. I estimate the car will make it to 250,000 fairly easy. So my target price range for the car was $3,567 to $4,280. I ended up buying the car for $4,000. There are some other criteria the vehicle must meet as well, such as clean CarFax, maintenance records, pass my mechanics inspection, etc. That's my process for buying a car. Might sound crazy, but the 3 vehicles I've purchased using this method have had a total cost per mile (vehicle cost + Gas + Maintenance divided by miles driven) less than 17 cents. Not too bad considering the government reimburses 57.5 cents per mile.