If you're actually spending another $5000 as part of the change, then no. If you're able to free up a significant amount of capital (such as if changing it for a 2005 Civic rather than a 2012), then go for it.
Think about it, if you invest the $5000, you might make enough in returns to cover the extra gas anyway.
If the Civic is $5000 more than the Subaru, and it uses 32mpg, whilst the Subaru uses 24mpg. Let's assume that your post-tax investment returns are 7% and you drive 9600miles a year. If you keep the Subaru and invest the $5000, you'd earn $350 on that investment, whilst using 100 gallons of extra fuel. If fuel's $3.50 a gallon, all else being equal, it's pretty much line ball.