Car wouldn't accelerate (gas pedal wouldn't work)... but was fine a half hour later

This morning I was driving my 2000 Ford Taurus to work at about 45mph when it suddenly starts to slow down as I was pressing on the gas pedal. I pumped the gas pedal as it was slowing but still nothing. I pulled to the side of the road just as it was coming to a stop. I turned the car on (everything seemed fine) and all the lights came on and the engine started. I was in park with the car on and pressed the gas but the engine didn’t rev. I turned the car on twice over the next twenty minutes or so as I waited for the tow truck. About a half hour into this ordeal I turned the car on again and tried pressing the gas and this time the engine revved so I put the car in drive and drove it around the block. I eventually canceled the tow and drove the car home and to school (about six miles total or so, at speeds under 45mph). I recently filled up the tank and had car problems last week (the car now has a new battery and alternator) but up until this morning there was no issue. Anyone have any guess as to what it could be? The shop said it would be hard to diagnose unless they could recreate the issue…

It might be a fuel pump problem. If the problem is intermittent it could be hard to diagnose, but you could have the shop check the fuel pressure. If it’s low that could indicate a weak fuel pump.

Is there some detail missing from the OP’s description of what happened?

We were told that, “it suddenly starts to slow down as I was pressing on the gas pedal. I pumped the gas pedal as it was slowing but still nothing. I pulled to the side of the road just as it was coming to a stop. I turned the car on (everything seemed fine) and all the lights came on and the engine started”, but it is unclear to me whether the engine actually stalled, or if the gas pedal just had no effect on the engine.

I know that you restarted the engine, but…Did the engine stall, or did you shut off the ignition prior to the re-start?

Throttle Position sensor bad or fuel pump.

I suspect that if you look at where the throttle cable connects to the throttle body, you will find that the plastic has broken so that the cable can slip out of place easily. The problem with this theory is that I cannot explain how it got back into place by itself. Usually people have to put the cable back and secure it with a zip tie or tape until they get a new cable.