At the last possible moment; at the last minute.(adverb)
Wiktionary.org : Text is available under the Creative Commons Attribution-ShareAlike License
Use "in the nick of time" in a sentence
"There was enough paint and feathers to outfit the whole Sioux Nation, the braves whooped and ki-yikked and brandished their hatchets, the roughriders curvetted, a stagecoach of terrified virgins was ambushed, the great man arrived in the nick of time blazing away until you couldn't see for smoke, and the Queen said it was most curious and interesting, and what did the strange designs of the war paint signify, my dear Sir Harry?"
"Jeendan's departure came in the nick of time for me, for one more amorous joust with her would have doubled me up for-ever."
"I stared admiringly and only remembered in the nick of time that I was supposed to be a hopeless scrounger."