Let's start with the last thing you mentioned first... The leaking valve cover gasket is a big problem. It can absolutely be the cause of your BMW's smog check failure. We highly recommend replacing the gasket(s) and driving your BMW for at least 500 miles (and while using engine cleaning additives) in order to burn off the carbon buildup which has accumulated on the valves and engine head. Increased engine compression is one of the leading faults responsible for high NOx. Not to mention, if you had oil seeping in to the combustion chamber during the smog check, air to fuel ratio would have been disrupted... further leading to increased emissions. Once the gasket problems have been resolved and the engine decarbonized as best as possible, you should have the vehicle retested. From there you can continue the diagnosis in the unfortunate event your car still fails.
posted by SmogTips Support