in the nick of time

중상급 (B2) informal

Just before it was too late.

"The firefighters arrived in the nick of time to save the building."