You might look into a TPS.
I know it sounds crazy but I just went through this EXACT same problem with my 99 last week.
I had been having an issue with it randomly accelerating on its own while i was crusing down the highway, as well as it (once it got good and hot) slamming and jerking really bad when coming out of overdrive (to the point where it would actually burp some tranny fluid out of the vent on the top of the transmission). The random accelerating (it was bad enough that it would change to 3rd gear, come back to 4th, hit 3rd again, and go back to 4th) would go away after about 5 seconds or so of that crap...and wouldn't do it again till another random time.
I had (thanks to the help of a scanner I borrowed to my dad) pin pointed it to the TPS. While crusing with it behaving normal, the TPS voltage (in percentage on this scanner) would hold at about 25-30% based on speed. When it was flipping out, that number was all over the place....from as high as 60% to as low as 20%...all while I was holding my foot and the throttle still. I was also showing sometimes an idle percentage of 20%, when it should have normally been around 15% or so.
Now getting to your problem, I also began to have the problem you described, in addition to the shifting problem. I had let it sit about a week and forgot to cut off my radar detector and it killed the battery. I charged it back up and went to crank it....and all it would do was crank...it would try to run and sputter a bit, but never fully did catch all the way. I gave it some gas and it immediately came to life, but died the minute i let off the throttle. I fired it back up again, and had to hold the throttle down to keep it running, untill it got warmed up for a bit. Once warm, I could back off the throttle to idle, and it would dip down like it was about to stall, then recover itself and be good to go.
This never happened again untill about two weeks after I killed the battery...(in other words, last week) when it happened twice in one day. Once while on a stone cold engine that had sat all night, and once after I drove about 40 highway miles and it was fully hot. I put a new TPS on, and started it up. Ran great, only problem was it idled way too high....right at about 1500rpm cold and around 1300 warm. For some reason, driving it and then restarting the engine about 4 times made it to back to normal. Havent had any problems since, and I installed the TPS Sunday and have put almost 200 highway miles on it since.
While you're under the hood, it wouldn't hurt to pull the throttle body out and spray it good with brake cleaner or throttle body cleaner. Go ahead and hit the dealer for a throttle body gasket (cost about $3.50 or so for me) and replace that while you have the throttle body off. I did this while I had the sensor off.
I also, because of the poor shifting and the burping tranny fluid on more than one occasion, replaced the tranny filter and did a fluid change....just to be on the safe side, and that I had not done in it in the two years i've owned my Jeep now.
I also had hooked it up to another scanner that my dad has that measures the TPS voltage, as well as the angle of the sensor when throttle is applied. The old sensor was showing an angle of 3* when at "idle", and the new one shows a angle of 0*...which was another sign that the TPS was my issue. And that small of a difference will not really give much of a noticeable difference in idle. However, my idle is holding steady at about 750 now, where as it used to go b/w 730 and 760 give or take a few.
Are you having any of the shifting problems, like I was having? Like I said my issue was coming out of overdrive (in other words, taking my foot off the gas at any speed about 45mph). Other than that it ran through the gears just fine like nothing was wrong.
Oh, and the fuel filter is inside the tank...which requires you to drop the tank to replace it. Not really THAT difficult of a job....just harder than it should be (even harder if you got a full tank of gas....lol)