Going to mirror a lot that was already said, but summarise based on my thoughts.
E46: The six cylinder engines, especially the M54 is fantastic! So much character, decent power, and not as heavy on fuel as one would typically think, especially when used mostly on the open road. Tough as nails if looked after and really not that hard on the wallet to properly maintain. The 330d is also a gem, but I would be wary of the 320d - these engines often had problems sadly. In both cases, while performance and economy is very good, maintenance is generally more expensive than the petrol engines and there are things to look out for. Dampener pulleys tend to fail eventually, usually you can pick up on this before it fails, or replace as a preventative measure since it can cause damage as well as leave you stranded since all belt driven ancillaries stop functioning. Problem is finding them with low mileage and in good original condition, and with the spec that you want.
E90: Ja, rather stay away from the 320i. I personally feel that the diesels are fantastic and overcome most of the niggles from previous generation engines. Dampener pulley is still an issue. Maintenance is also still more expensive. Performance and economy is fantastic. The six cylinder NA petrol engines are good but not quite as economical as the older E46 M54 engines. Maintenance is mostly the same. Automatic gearbox in the E90 is pretty good, especially the later gearboxes. The 320d and 330d are both fantastic with either manual or automatic gearboxes. The lack of a proper spare wheel and place to put a spare wheel counts as a negative for the E90 along with RFT's. On the normal suspension 17" RFT's aren't too bad in terms of ride, but larger size and especially with the sport suspension is the makings of a harsh ride. But, ditch those RFT's and even 18" wheels on the sport suspension is softer than 17" RFT's on the normal suspension! Suspension is more complicated and therefore more costly to repair worn parts and diagnose. But with all said, it is far easier to find the right E90 for your needs at the moment...
Hope this helps! :thumbs: