2005 Hyundai Sonata GLS stalled during heavy rain
I bought the 2005 Hyundai Sonata GLS last week. It has 180k on the engine, but it was well cared for, so I figured I'd get a couple of good years from it. This isn't the first time I've driven it in the rain, but this is the first time I've driven it in an unholy deluge and the engine came very close to stalling out completely.
Today, and I was driving through at least an inch of standing water, the engine power dropped and the check engine light came on for a second, then it picked up when I applied the accelerator. It acted sluggish for about two more miles. I parked it. I turned it off completely, then tried to restart it. I would start, but it would not stay on. This happened twice. I turned it over the third time and it stayed on. The rain let up to a reasonable shower, and the car drove without another issue for 15 miles all the way home.
Other times while driving it in a light rain shower the car ran just fine. It seems that when I was driving on somewhat flooded streets today it aggravated something, and that's a sign that something needs to be repaired before it gets worse. I wasn't able to get a code since the check engine light was only on for a second.
This car has a 2.7L V6 engine. Any idea what the problem might be?