My advice is purchase a real clean 535i 5 speed for about 8-9K or so...and keep the balance of money you were planning to spend in a slush fund for future repairs. A real nice M5 is at least in the high teens for purchase price and if thrashed with a lower selling price you do not want it as it will cost much more in the long run. All the M car's are hard to beat but you will pay handsomely for an exceptional one. There are presently a couple of enthusiasts on this board rebuilding their M-motors and they will tell you first hand that rebuilding a M//big six is very expensive. Conversely if you have to tackle a relatively bullet proof/simple M30, they are inexpensive to rebuild and relatively easy. So all depends what you want. Most of us would be driving a M car on this board if it weren't for cost of ownership...they are wonderful cars...but for value i.e. cost versus benefit....the 535i 5 speed car is very hard to beat.
HTH,
George