The last gear engaged should be the moment you lose control. So, in your example, it would be fifth gear. You would take a 5th Gear card, flip it to its spin out side and put it in your time pile.
If the third hazard was on the forth gear die, you would stop movement at that space, take a 4th Gear card, flip it, and put it in your time pile.
But in both cases you would receive Second Markers for all dice rolled no matter how far you car physically moved.
Hope that makes sense, John.
Ah, it just clicked. Thanks!