This is actually a great time in a plane's life to buy it, IF it is properly priced.
Generally, the pricing for airplanes takes into account the cost of an engine overhaul. If you have a ~$100,000 airplane that has an engine that costs $40,000 to overhaul with a TBO of 2000 hours, if it's got a new engine it'll go for $120,000 and if it's got a fully run-out engine it'll go for $80,000. This does NOT take into account the amount of money you spend for removal and reinstallation, accessory replacement, etc. which will generally run between $6K-$10K; it is ONLY the amount that the overhaul shop charges. And in reality, you don't always get the full amount back at 0 SMOH because there is the possibility of infant mortality; and after about 2/3 of TBO the line will trend downward somewhat because people seem to be afraid of engine overhauls and/or just don't want to deal with it themselves.
But, engines don't just drop dead at TBO. Especially the kind of engines you see in trainer aircraft... If they're run frequently, they can go a LONG time. Normally aspirated 320s and 360s can sometimes go WELL beyond 3,000 hours. And if you buy an airplane with a run-out engine, fly it, and sell it without overhauling... It's still just an airplane with a run-out engine and you might get back every dollar you have in it. If you do have to overhaul the engine, you'll still get back most of what you put into that.
In the past, when I've bought airplanes I've created a spreadsheet to basically mimic Vref. I put in the asking price, TTAF, SMOH, and what avionics it has compared to how I want it to be equipped. The spreadsheet tells me what the plane is worth, and the differential between that and the asking price. That's a good way to tell whether the airplane you're looking at is really the screaming deal it seems like, or if it just looks that way because it has high time engines. In any case, I prefer to buy airplanes with higher-time engines and run them until they need an overhaul... All the time you get past TBO is "free."