in the nick of time

[in the nick of time] {adv. phr.} Just at the right time; barelysoon enough; almost too late.

The doctor arrived in the nick oftime to save the child from choking to death.

Joe saw the othercar in the nick of time.

Compare: IN TIME.