There are not many things that can require a $5,000 repair, unless you're crashing your car into things in which case a new car is going to hurt your even more.
A $5,000 repair is still cheaper than an $1000/mo car+insurance payment. Unless you're replacing your engine or transmission every 4 months then you're still going to be paying less by covering the repairs.
The cost of ownership of a used car 5-10 years old is cheaper than a new vehicle. This has been the case for decades. Buying a new car has always been the most expensive option in both the short and long term.