I would take your car into a BMW dealer and tell them your car failed an emission test. The car is covered for emissions for five years or 80K miles.
A
P172 code means your O2 sensors are seeing too much unburned fuel. O2 sensors do go bad on these cars.
http://www.obd-codes.com/p0172
IS your car mod'd? DP's ??? Do you still have your cats? The vacuum lines going to the turbos have been known to pop off. You might start there. Might as well have your HPFP replaced while your there - if it has not been done under the recall.
Dack