You're leasing that TSX, right? So, in order to keep it, you'd have to put up cash? I expect it's a bit more than 19k to keep that TSX. But, if you're really putting a shit-load of miles on your car, it makes more sense to keep the younger car.
I drive 10,000 miles a year. So far, I've done a single out of pocket oil change on the 330. That's it. I expect that when I get closer to 100k miles, I will need to lay out for spark plugs, possibly front suspension components. If you buy a 330 with around 60k miles on it, be aware you'll need to spend somewhere between $250 - $500 on replacing the battery. You'll also probably need to do the brakes, which could cost up to $1000? Assuming professional installation.
Buying a six year old car, you'll need to pay out of pocket for these things, and fairly soon. Google for E90 battery replacement procedure -- you have to "register" a new battery with the car computer, which means you need a professional tech or the proper tool to DIY. Obviously, if you can score this car for 15k, then do it. But I'm not sure where you'll find it.
You need to figure in up-front cost of known required maintenance, as well as $1500-$2000 for taxes and fees. You should consider that part of the purchase price. This is the case for any car, but I can at least advise you on what I had to pay on top of retail price to get into my 330. You can consider whatever you're paying on maintenance in the years beyond that as your car payment. Even though $2000 a year sounds like a lot of maintenance, that's still only $167/year.
But, all that being said... you'll love the car. I'm personally glad that I don't have a 335. I don't need to own a car that fast. I'll get in a lot
So: what's it going to cost you to keep the TSX? Consider that along with whatever other used cars you're looking at. Tell your friend to buy a new BMW and sell you his 330ci?