18k can pick up a nicely maintained, higher mileage ~2002 M5 - if you want raw power and tons of torque, as well as a classy sedan, you can't go wrong with that car. Be aware that some parts are ridiculously pricey - a pair of front rotors will run you $500.
S4's....well, not my thing personally unless you go back to their twin turbos of 2000-2002...and those are tuning platforms unless you buy one already tweaked out right. However, you can buy a clean one for 10-12k and fix all the weakpoints for another 5k.
M3s are awesome cars - for 18k, you can get a higher mileage one in good shape.
Personally, I'm planning on the m5 in ~1 year or less. I need to own one, once