3rd Gen Ram Tech2002-2008 Rams: This section is for TECHNICAL discussions only, that involve the 2002 through 2008 Rams Rams. For any non-tech discussions, please direct your attention to the "General discussion/NON-tech" sub sections.
i would check the tps, and the egr, when you have an egr malfunction or vac leak the computer will try to compensate for it, causing and irregular idle patterns like your are experiencing(although 1000rpm is a bigger jump than normal). as for why it only happens when the truck sits, sometimes when the egr is leaking or another vac source is leaking the hole is very small, many times small enough where after the motor heats up enough the heat will expand the metal/hose and seal it, making it run normal. hope it helps, if nothing else its something you can cross off the list of possibilties
also if it was mass air flow sensor your light would more than likely come on imediately , im not a dodge tech but in most manufacturers the air flow sensor flashes instanly when its malfunctioning as opposed to something like a missfire which has to reach a certian number of faults for the light to come on