The idiom "down to the wire" means waiting until the last minute to do something.
Example of use: "I went partying yesterday and forgot that I'm supposed to submit my paper tomorrow. It’s gonna be down to the wire and I’ll have to pull an all-nighter to finish it on time".
The origin of the idiom “Down to the Wire” is in Horse-Racing. In the late 19th century, a small wire was strung across the track, above the finish line, to help the judges determine which horse crossed the finish line first. An early example appeared in the July issue of Scribner’s Magazine in 1889, in the story ‘How the derby was won’: “As the end of the stand was reached Timarch worked up to Petrel, and the two raced down to the wire”.