So after 5-6 months and you have no other repairs, you come out ahead. New cars come with a payment, higher insurance and DMV fees.
Replacing the engine will add 6-7 years of life into that car. I've done it myself on a Honda Accord I still drive from time to time. I have 350,000 miles on it and had I replaced it, I would be less ahead than I am now.