Hopefully its something minor, but as a result of poor maintenance by previous owners, my 88 300E failed the idle speed emmisions test but still passed the high speed test. Mechanic determined that engine management computer was running in open loop mode (not managing engine), he fixed that but it still wouldn't pass. Service tech then pulled the valve cover and discovered badly worn cam lobes which was causing engine to emit too much bad stuff at idle speed. Result, major bills. I have heard that if a car fails the high speed test then the catalytic converters could be a potential source of the problem.
My suggestion unless you are a good benz mechanic yourself, take it to a pro for a diagnostic. A friend of mine has an 02 WRX also, sweet car.