The 2.9 407 petrol suffers from VBT bearing failure.
My 2006 407SV had 1 set done under warranty at 40k; another lot at 80k ($3,000) and they were starting to rattle again when I sold the car at 120,000km.
They rattle just like big-end bearings at cold start.
I’d go for the diesel.
I have a 407 2.7 HDI. It is a beautiful engine to drive, smooth, powerful, quiet etc but is plagued with expensive, trivial problems. I'd go with the 2.0HDI too (which we have had in the 306 and 308). Mind you Peugeot has put out the 3.0 HDI, allegedly improved and I'd love to try one of those.