Dirty MAF and fuel filter would be (and were) my first things to look at. Though it could be a few things. The CEL is leading me more to an O2 sensor, but a MAF or IAT problem will throw it as well. When my IAT was disconnected (playing with the intake, forgot to hook it back up) the car ran fine till it got warm. It started surging, then I got a *blinking* CEL. A leak in the intake, after the MAF will also give you idle problems. A vacuum leak will make it run poorly, especially if its a large leak. Old worn out plugs and wires will cause problems, but I noticed more of a fuel mileage issue. Last but not least, your cams may be lined up incorrectly. That can be caused by a worn tensioner that allows the belt to jump a tooth.
I checked each and every one of those when my car had its issue through June and part of this month. I kept ruling out my (new in Jan) MSD wires. I cleaned the connections for my coil, IAT and MAF. I also cleaned the MAF, and double checked the plugs. Everything was checking out fine, but the car still ran like crap. Just out of curiousity and boredom, I pulled the valve cover, found my cams were not lined up, and fixed that (stupid mechanic!). It still ran like crap, but like smooth crap.
The plug wires were showing no resistance. For ****s and giggles, I talked to the guy at the parts store and he let me try a different set of stock replacement wires. It now idles so smoothly, you can't even hear it, and that is with a Flowmaster attemting to quiet the exhaust!
...that was a long reply. :p