That particular problem is typically caused by a dirty/sticking IAC (idle air controller). Try this... with the engine running at IDLE rpms spray an aerosol throttle body cleaner into the throttle body. Only at idle rpms will the cleaner be pulled through the IAC to clean it. The engine will die, just keep restarting it and spraying more cleaner into the throttle body. Raising the rpms to stop the engine from stalling while spraying the cleaner will cause the cleaner to bypass the IAC and not clean it. The IAC is the engine's sole source of air at idle rpms so when it gets dirty, and they do, it will either make the idle rougher or it won't be able to run at all without giving the engine more gas which opens the throttle body valve plate to give it more air.I have a 2004 Wrangler Rubicon. 4.0, 5 spd, 147000 miles. The Jeep runs and drives great, except at idle. The idle is rough. Just slight pressure on the throttle smooths it out.
Possible intake manifold gasket or other vacuum leak that seals once the engine heats a little?I have the same issue on my 06 Rubi, but it only happens a few times a month if that. Not sure what the issue is. It goes away after a few revs.