I had this problem (on my Explorer and a Chevy Corsica) and it was the fuel pump relay. The contacts start to get funky and they only work sometimes. On the Explorer I had no drivability symptoms, but I happened to get a KOEO code for fuel pump voltage when troubleshooting something else. It turned out that maybe once every 10 times the key was cycled it didn't work.
If you pull out the relay (if its an OEM ford one) and look at the bottom where the pins come out, it should be fairly white. If it has a lot of discoloration and has turned brown that is another sign that the relay is not doing so well.
I doubt it is the pump, especially if it works fine when it is running.
Make sure you get a decent relay, they are standard automotive relays but the cheap junk ones from the chain parts stores are not the best.
When I replaced the fuel pump relay on my truck, I replaced the EEC one as well. I figure they have as much usage on both of them, and if they fail you are going to be on the side of the road. (plus the base on both of them was very dark and discolored) I tossed the old EEC one in the glovebox as a spare...