Intermittent loss of power/electic - 2004 Hyundai Elantra

It is very random. I replaced the crankshaft position sensor and thought that did it but it just came back 2 days later. Some days it will run without a problem and others it’s hard to start or keep running. I checked fuel pressure and spark, all are good. It’s like it just hiccups once an stays on or it will just hiccup until it stalls. The CEL flashes as soon as it hiccups but goes out if it corrects. No codes are thrown and all voltage is constant. My suspicion has been the ECM but was trying to get as much info from other people before pulling the trigger. If and when I replace the ECM, I will let you know how it went.

No way to tell as far as @elantraGLS2 's ecm, but electronic gadgets like that can be damaged by voltage spikes. From a defective alternator, but more likely it would be from jump starting. That kind of damage can wait show up a day or two or even a week later. That said, themost common reason ecm fails is b/c of broken solder joints or broken traces from thermal expansion of the pcb.

This seems to be happening more and more according to what I see on the web. I am having the same issue with a 2013 Elantra and I have seen a lot of similar out there. It has to be something electric because the car will stall or simply do a quick cut and recover, then when you hit the gas you will notice that the tachometer does not register and there is no compression. Simply turn off the engine and restart and all works fine. So something is going and it is not a blown head gasket or a valve (also no oil leak or smoke from tail pipe) it has to be electrical… ECM make sense so I will try that and see what happens… Thanks for the info.