As with purchasing any kind of car I would suggest doing as much research as possible including an extended test drive (not a 5 minute cruise around the block), it also would not be a bad idea to test drive/look at the competition. Figure out what options you want and price the car out online as well as determine the invoice price...... last find a dealer that is willing to work with you on the purchase.
On a side note BMW has a very nice CPO program so if your not opposed to picking up a year or two old model with low miles you can possibly save yourself some serious coin too.
Good Luck