Down to the wire (just in time)

At the eleventh hour / In the nick of time


Sul filo di lana

All'ultimissimo minuto


Meanings
Just in time; almost too late

Examples
The player gave the right answer in the nick of time, just before the buzzer beat him, and he won ten thousand dollars
Il concorrente è riuscito a dare la risposta giusta sul filo di lana, proprio prima dello scadere del tempo, e si è aggiudicato la bellezza di diecimila Euro

We almost missed our flight; it came right down to the wire. The traffic on the way to the airport was horrible and we had to run to our gate
C'era un traffico terribile sull'autostrada e siamo arrivati all'aeroporto all'ultimissimo minuto. Abbiamo preso l'aereo per un pelo e solo perché siamo andati di corsa al gate

Origin
This phrase refers to races where the winner is determined by whoever crosses the finish line first. In horse races a real wire is stretched across the finish line, while in human races the so called “wire” is a ribbon, a string or a tape. It's meant to help the judges see clearly who crosses first in a close race