I've actually pondered the same thing because my car only gets around 26 in normal city driving, and I get about 32 on long trips if I hypermile. I'm keeping my car for now just because I don't drive enough(9k miles/yr) to justify spending money to get better mpg.
The math:
18,000 / 25.6 = 703.125 gallons. At $2.50 a gallon = $1757.81
18,000 / 47 = 382.97 gallons. At $2.50 a gallon = $957.44
Difference = $800.3725
If you are going to spend 5k more it would take 6.24 years to justify the purchase.
This is roughly the same conclusion I came to when I ran the numbers. My car doesn't have good mpg, but as long as it is still running it is still cheaper than getting a newer used car with better mpg. I'll drive it till it is on its last legs, and then get a car with better mpg.