Go for the M340i, you will be thanking yourself. Great ride and handling balance, much more fun since its a sedan (even if it is half-M vs full-on M) and the B58 engine is a peach and is much better down low with power.
I really dislike the X3 M's ride, it was so bad that my dog barfed from how bouncy and hard it was. Some may argue that "its an M its supposed to have a hard ride" but in my opinion M is not an excuse for a hard ride, you can have a comfortable ride and still excel at handling, just look at Porsche or GM (magneride) both of which can outhandle their competitors while still being firm but not harsh, and being an SUV first and foremost which will carry children, family and pets more than it will ever see a track I think its a bit inexcusable honestly.
Good luck with the trade OP.