You need to consider the cost of repairs vs. the value of the car. The
longer your willing to keep the car, the more you'll be willing to invest
in repair. I put a $1500 transmission in one of my Tauruses that I knew
I'd only be able to sell for $1000 to $1500. The reason I did it was that
I knew the car was in good condition mechanically and that I'd have
difficulty finding a better (or even similar) car for that same money.
The end result was that I got another 70k out of the car. I thought that
was a fair deal.
Do some soul searching and decide what you'd like to have as well. Would
you rather have the Hyundai or something different?
I always have difficulty answering questions like this concretely because
the answer is different for each person. It's all based on what the
individual wants and what they believe is best for them.