Plot hole: Jim taking over Sam's body just doesn't make any sense. It's plausible for a spirit to temporarily take over a living body, but a dead body is dead for a reason. It can't sustain life anymore. Death isn't a temporary ailment. It's permanent. What should have happened was the same thing that happened when another ghost took over a recently deceased person, which happened in a previous episode. The dead body would decay and start to lose function. Sam's body suddenly gaining back the properties of life is completely inconsistent with what we're led to believe in the setting of the show.
Suggested correction: This is a fictional show that pushed the boundaries and constantly changed the rules; how is this a mistake?
I tell myself that Sam's injuries were not as extensive as prom ghost so his body was able to stay alive.
I think what happened is that Sam jumped out and went into the light before they were able to revive him. Had he waited just a few more seconds next to his body He would have gone right back in. Some people die for a few seconds, and then they're able to bring them back through CPR or using the paddles and shocking his heart, etc.