In the Nick of Time
Just in time, or at the last possible moment.
The hero always saves his damsel in distress in the nick of time.
Did you know?
This idiom stems from the fact that in the 1580s, a nick was known as a narrow and precise marker.