I had a truck act kind of like this many years ago, it turned out to be a safety switch on the transmission went bad. It's the switch that will only allow the the vehicle to start only in park or neutral. Dunno if thats whats wrong with yours or not but it's worth checking.
I've also had a fuel pump that would run fine one minute, then quit working the next. It took forever to get it figured out.
I hate problems like that that are intermittent, I just wish it would break!
Coils are pretty cheap, probably worth replacing if you think it could be the culprit.
88 Wrangler, Rebuilt I6, NV3550,Atlas 2,B&M Shifter,38/38 Weber, Skyjacker Lift & Nitro Shocks & Stabilizer, Black Diamond Discos, 35 " Regul MT's & Outlaw 2 Alum Wheels, 4.88 Gears, Dana 35 & Super 35 kit & Detroit Soft Locker, Dana 30 & Superior Axles & Detroit Soft Locker & No Disco, SRC Front & Rear Bumpers, SRC Side Armor, Warn XD 9000 I Winch & In Cab Controls, OR Fab Tire & Can Carrier, Rock Hard 4x4 Full Cage, Hood Rack & Hi Lift & AX, Outland Seats, KC & Silverstar.