Longest lasting of all time:
Mercedes Benz Diesel used in their W123's. But... diesel by it's nature goes longer than most gasers. It's common for these to go past 500,000 before needing a rebuild... then they can go for another 300-500k miles. There's reports of these engines going over 1,000,000 miles overseas where diesel engines are more popular (due to their reliability and superior gas mileage).
My favorite gasers:
Toyota 1.8 liter, 7A-FE: Found in the Celicas, Corolas and Camry's. Known for smooth operation, and reliability. JD power & associates awarded the Celica the "Most Reliable Used Car" more than any other vehicle.
Toyota 22RE: They're heavy, but SUPER reliable. IMO the best I-4 truck engine ever built hands down.
Volvo red's: Won't win races, but it'll get you there over and over and over again.
GM 3800
I don't like the BMW engines, as they're just too expensive and complex to fix when they do break down... and they DO break down. They're plagued by cooling issues, and to me - that kills their "reliability" if you're talking best-of-the-best.
Best of all time:
despite the other the #@$%! American car companies were putting out at the time, the chrystler slant 6 was probably one of the best motors of it's day.