It has nothing to do with GameShark or ARMAX hacks. Replays comprise of recorded scripted input from the player that are executed in sequence on the track. Unfortunately, this system's success maps entirely on the game engine's ability to perfectly mimic your driving conditions.
Hence, if the replay--the "script"--encounters a moment that involves random variables, and the outcome does not perfectly match that of your original driving session, your car may spin out, but it will continue to execute the remainder of the replay's sequence of instructions while driving into, for example, a wall.
It's influenced by the car used and driving behaviour, but it will happen the most often on Driving Park Motorland; possibly 30% of the time, largely depending on your driving.