I'm not expert, but would try putting car on blocks to try to re-create the problem while parked. That would allow for trouble shooting while problem exists. Hard to fix when working. With car on blocks or lift to make it die, verify if have spark, and check fuel pressure at engine. May be electrical short caused by swinging wire. Wish you well on that.