Boats with motor problems???
I think Sailaway''s estimates reflect an assumption that you do the work of removing and re-installing the motor yourself.
From personal experience, the factory charge to rebuild a Westerbeke W35 is about $7,500. Having a competent yard remove, pack, and ship, the worn motor and then re-install the rebuilt brings the total job closer to $12-14K. Doing it yourself ain''t for the faint of heart or for people who don''t have a lot of spare time. While the engine is going back in becomes a natural time to to replace all hoses and belts, new engine mounts, rebuild/replace alternator and heat exchanger, and any other lose ends easier to do while the block is out, all of which serve to jack up the cost. If done by a good yard, the end result is an instalation that is probably better than new.
My personal advice buying a considering an experienced boat (anything over a couple of hundred hours) is to look for one that already has an engine rebuild (like mine, which is not for sale...)and happily pay the premium the owner would expect. These premium prices always significantly discount the cost of the work. Otherwise, absolutely have an engine survey done by a desiel engineer, including a compression test. A "sea-trial", even performed by a mechanic doens''t cut it, and our $13,000 engine job is the proof.