Murray did not get on court until 1am in Washington DC (6am BST) and he was taken the distance to grind out a 6-7(5), 6-3, 7-6(4) win against Marius Copil.
The victory, which drew to a close just after 3am local time, ensured the former British No 1 cemented his place in the last eight.
Murray has been through a nightmare 12 months with a career-threatening hip injury and he was full of emotion after reaching the latter stage of the tournament for the first time in years.
After returning to his chair, Murray sobbed for minutes while holding the towel to his face to dry the tears.
Murray has been far from his best the week but was still able to reach the quarter-finals.
Little separated both players in the opening set as they were taken to a tiebreak but Murray soon stormed into the ascendancy with a five-love lead.
However, his mental fragility quickly came to light as he lost the next seven points in a row to find himself a set down.
Injuries have plagued the former British No 1 for well over a year but he is attempting to rediscover his form of old on the American tour.
He responded to the disappointment by breaking once in the second set and winning 6-3 to level the score.
What looked like a vital break came in the sixth game of the third set as Murray went ahead for the first time in the match.
But Copil struck back in the following game to level and the match went to a final tiebreak – which he won with his first of three match points.
Murray will face highly-rated Australian youngster Alex de Minaur in the next round.