Couldn't hurt, although I'd guess filter over pump (if it was bad gas). But first, change your sparks; they could be fouled up. If your filter is clogged, it will (in my experience) also hurt your power, since if it's clogged enough to hurt you idle, it'll be starving for fuel at higher RPM's too. Next thing is injectors. I ran the tank of my Subie dry and ended up with a bad injector (change them all if you can).
Depending on what you meant by "bad gas", it couldn't hurt to add dry-gas (if it was water) or better, flush the tank and get the crap out. Water stays at the bottom of the tank, where the pickup is (so doesn't most other crud). Adding more gas just puts good gas on top of bad gas, and it'll still run like crap until it's all through the system. If it was only a little water, dry-gas should work, but if it's really bad, just get it cleaned out.
Of course other things can make an engine idle rough, like O2 sensors, etc., even bad connections to them. I had a Pontiac (ugh) once that started running really poorly (both at idle and while driving). Turned out it was one little-bitty 6-inch long vacuum hose going to the MAF had popped off when I tried to crank it a second time before the engine stopped turning. Plugged it back in, and it worked fine.
So, check all your vaccum hoses, etc, change your sparks, dry-gas it. If that doesn't work, change the filter, and have the codes check (it should tell if the O2 sensor is something is bad). If that doesn't work, flush the tank. I hope that'll help.