First off, go ahead and calculate the number of gallons used per month, like so:
Prius: $\displaystyle \frac{800}{45} \approx 17.78$ gallons per month.
Other: $\displaystyle \frac{800}{25} = 32.00$ gallons per month.
Next, assuming gas is four dollars a gallon, calculate the cost per month...
Prius: $17.78*4 \approx 71.11$ dollars per month.
Other: $32.00*4 \approx 128.00$ dollars per month.
Now we want to know how a car costs after $t$ months, taking into account the initial cost.
$C_{\text{Prius}}(t) = 20000 + 71.11*t$
$C_{\text{Other}}(t) = 15000 + 128.00*t$
Next, we want to know what the difference is.
$\begin{eqnarray*} C_{\text{difference}}(t) &=& C_{\text{Prius}}(t) - C_{\text{Other}}(t) \\ &\approx& 5000 - 56.88*t \end{eqnarray*}$
In order to make any savings just from gas alone, we want to know what the minimum value of $t$ is such that $C_{\text{difference}}(t) \leq 0$. In other words...
$5000 - 56.88*t \leq 0$
Solving this equation through any number of methods yields $t \approx 87.891$ months.
In other words, keep your Prius for at least 88 months (7 years 4 months) and you have savings from the reduced gas consumption. :D
EDIT: General formula for when you don't know the price of gas ($g=4$ in my example):
$\displaystyle t \geq \frac{5000}{14.22g}$ months