the 524td engine bases on the old M20 engine and has the same problems (timing belt, hairline cracks in the cylinder head), the M51 (525td and 525tds) often has problems with the diesel injection pump (bad idle speed), diesel pump in the fuel tank (engine runs only when the fuel tank is more than half filled), leaky oil leakage pipe and so on... the 525tds is more vulnerable for these damages than the 525td - it's overwrought with 143hp for an old turbulence-chamber diesel engine.
if you really want an unimpeachable diesel, take a Mercedes W124.