So my friend had gained control of my Wurmcoil Engine and attacked me. When damage resolved Wurmcoil Engine and myself had lethal damage, so both myself (player) and my creature with a "when this creature dies" effect die at the same time. Would my friend controlling the Wurmcoil Engine still receive the two tokens from Wurmcoil Engine dying? my understanding is that when I die, everything I own is removed from game thus when the check is made on the ability of Wurmcoil being in my graveyard to generate the tokens, it would not be in my graveyard but instead be in exile along with everything else.
A good resource in this situation is http://chat.magicjudges.org/mtgrules/ - their answer follows:
Both them losing and Wurmcoil dying happens as part of the same "set" of State Based Actions. Wurmcoil will hit the graveyard and they will lose at the same time. Wurmcoil will still trigger in that case since it did, in fact, die.
Edit: Relevant rules
118.6. If a player has 0 or less life, that player loses the game as a state-based action. See rule 704.
704.3. Whenever a player would get priority (see rule 116, “Timing and Priority”), the game checks for any of the listed conditions for state-based actions, then performs all applicable state-based actions simultaneously as a single event. If any state-based actions are performed as a result of a check, the check is repeated; otherwise all triggered abilities that are waiting to be put on the stack are put on the stack, then the check is repeated. Once no more state-based actions have been performed as the result of a check and no triggered abilities are waiting to be put on the stack, the appropriate player gets priority. This process also occurs during the cleanup step (see rule 514), except that if no state-based actions are performed as the result of the step’s first check and no triggered abilities are waiting to be put on the stack, then no player gets priority and the step ends.
704.5. The state-based actions are as follows:
704.5a If a player has 0 or less life, he or she loses the game.
704.5g If a creature has toughness greater than 0, and the total damage marked on it is greater than or equal to its toughness, that creature has been dealt lethal damage and is destroyed. Regeneration can replace this event.
704.5h If a creature has toughness greater than 0, and it’s been dealt damage by a source with deathtouch since the last time state-based actions were checked, that creature is destroyed. Regeneration can replace this event.
When you lose the game, you and everything you own (including permanents under other player's control and triggered abilities) leaves the game with you.
That said, a Wurmcoil Engine's trigger is not owned by you, but simply controlled by your opponent, even though the card that has the ability is owned by you - that is part of what a control-changing effect does for objects that aren't represented by cards (such as triggered abilities).
603.3a A triggered ability is controlled by the player who controlled its source at the time it triggered (...)
Therefore, the Wurmcoil Engine will be put into your graveyard by state-based actions at the same time you will lose the game. Its ability triggers at this point, and is put on the stack the next time a player would receive priority, which will be after you and your Wurmcoil Engine have left the game.
603.2a Because they aren’t cast or activated, triggered abilities can trigger even when it isn’t legal to cast spells and activate abilities.
Even though losing the game for having 0 or less life is the first item on the list of state-based actions, the order matters not in this case , since all SBAs are performed at the same time.
704.3. Whenever a player would get priority (see rule 116, “Timing and Priority”), the game checks for any of the listed conditions for state-based actions, then performs all applicable state-based actions simultaneously as a single event. (...)