It could very well be the O2 sensor. All I'm saying is even if you pull the O2 sensor and run open loop it won't affect gas mileage that much especially if you mostly cruise on the highway. I've run open loop for years and could go about 600km on a 55l tank at the time.
I would pull the plugs, re-check the condition and gap.
I'm just wondering why the car failed the first time then passed. How do you drive the car? Is it automatic? I'm asking this because the engine needs to run above 3k for at least a 10 minute period straight to blow out the crap once in a while (source:87 325i owners manual). This may or may not be the case for an m50 powered car.
Performance one step at a time.