under the wire
• at the last possible opportunity; just in time.
• "the team got into the playoffs just under the wire"
down to the wire
• used to denote a situation whose outcome is not decided until the very last minute.
• "it was probable that the test of nerves would go down to the wire"