in the nick of time

Intermediário superior (B2) informal

Just before it was too late.

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