in the nick of time

in the nick of time (at the last minute; just in time, with hardly any time to spare ) — ≅ в последнюю минуту; в (самый) последний момент; как раз вовремя; в самый раз (чтобы успеть)

Example : We had a flat tyre on the way to the airport so we managed to catch our plane just in the nick of time. (bbc)

cf.
[eleventh hour]

NOTE
At the eleventh hour implies that the event happened just before a scheduled, looming deadline.

In the nick of time implies that the event happened just before it was too late to prevent something (such as an accident). It doesn't carry the sense of racing to finish before a deadline.

see also
[have a narrow escape]
[a close call]
[saved by the bell]