I had a similar issue, on mine it was the fuel cutoff was malfunctioning, which happens when you have an accident, so the engine wasn't getting fuel.
Good outside shout. But I've not heard of them being intermittent. Its definitely soemthing ignition so fuel/spark/air/sensor. Possibly compression but again not sure how that could be intermittent.