I had intermittent stalling issues on my 2009 4.6 a couple years ago. It would stall once or twice as I slowed for a red light or stop sign. It would do it right around 5 minutes after a stone-cold engine start; after 10 minutes it was fine. Sometimes error codes, such as random misfires on different cylinders, would occur along with the check engine light. The dealer couldn't figure it out as it would not act up for them whenever they had their detailed
scan tool connected. They re-seated all electrical connections under the hood and at the battery; the problem seemed cured for a few months. When the problem came back it was much worse. Stalled at any time now... I limped it home; as I backed it into the garage it was belching black smoke out the tailpipes. That made me think "engine is running horribly rich" - way too much gas as if a fuel injector was sticking OPEN, flooding the engine. Got it flat-bed towed to the dealer. The dealer tried connecting to the OBD-II port to read error codes and could not get communication with the main engine computer.
They replaced the computer... too bad it was long after the warranty so it cost a pretty penny. But that has been the fix; it's been almost two years now with no hint of stalling.
If the dealer does replace the "PCM" as Hyundai calls the computer, make sure the dealer applies all TSBs and recalls for software updates. The replacement PCMs typically have the original software load, not the most current.
The crankshaft position sensor (CPS) was suggested as a problem on my car; wiggling the wires to it while the engine idled seemed to - sometimes - make it stutter a little but not stall. That was replaced... nope, engine still stalled. The PCM only tests the sensor while trying to start the engine: if the PCM doesn't "see" CPS pulses for 2 seconds (something like that) while the starter motor is running, the PCM decides it is bad and sets the appropriate OBD-II code. If the sensor fails after the engine has started however no code is set... so intermittent CPS problems (or failing wiring) would typically do not set OBD-II error codes. It would not be difficult to detect however by comparing to camshaft position sensor data: if the PCM "sees" camshaft pulses but no CPS pulses then it should know the CPS is kaput.
mike c.