Nadal recovered from losing the first set 6-0 to defeat Thiem and reach the US Open semi-finals following another late-night classic in NY.
However, the 32-year-old was fortunate to triumph on another hot and humid night at Flushing Meadows, 24 hours after Roger Federer had been dumped out of the tournament by John Millman.
The fourth set was a wild 81-minute ride that began with Thiem facing break points, saw the Austrian threaten a double break before being pegged back and then a tired Nadal miss a chance to win the match.
Post-match Nadal said that "suffering" was the "right word" to describe the 4 hour, 48 minute match.
"I don't think he's really sorry", said the 25-year-old. "He's a close friend on tour, a great guy and I wish him the very best".
Ninth-seeded Austrian Thiem is in his fourth Grand Slam quarter-final, but his first outside Roland Garros - where he was soundly beaten in the final by Nadal three months ago.
Obama, Bush mourn former rival McCain at Washington service
Senator John McCain made his last visit to the Capitol on Friday , lying in state in Washington before he is buried in Annapolis. As many as 15,000 members of the public waited in line for hours, as temperatures climbed above 100F, to pay their respects.
Nadal has the best part of two days to recover before a semi-final against Juan Martin Del Potro, while the world No 9 left a stadium largely drained of spectators with nothing more than a reminder of his opponent's incredible fighting qualities.
The Austrian was the first top 20 player that Nadal faced in the US Open since 2013 and broke the Spaniard numerous times in the third and fourth sets, but also made 58 errors.
Nothing could separate them in the opening seven games, with just four points for the returners before Nadal earned a break in game eight after a poor backhand from Dominic. I told him I was sorry and that he is good, he is a fighter.
The tired combatants held serve throughout the fifth - including one triple break point for Nadal - into another tiebreak.
It was the second time someone had taken a set 6-0 against Nadal at the US Open, with Andy Roddick doing so en route to a straight sets win in 2004.
The momentum was with Nadal but Thiem regrouped in the third set and began to again blast winners into the corners.
Amazon joins $1 trillion club, on pace to overtake Apple
Amazon touched a market value of $1 trillion Tuesday, becoming just the second publicly traded company to reach the milestone. But of that massive revenue, retail is slowly beginning to take a back seat to other higher-margin services.
"It ended up in the fifth set tiebreaker, there it's 50/50".
Del Potro reached the semi-finals for the third time, defeating John Isner 6-7 (5/7), 6-3, 7-6 (7/4), 6-2 and ending American hopes of a first men's champion at the event since 2003.
Del Potro, the 6-foot-6 (1.98m) Tower of Tandil knows it will be a battle against 6-foot-10 (2.08m) Isner, who has blasted a tournament-leading 112 aces. "I'm playing a lot of hours this year at this handsome stadium".
"To reach the semi-final again here in NY in my favourite tournament is very special to me", said Del Potro after his eighth win over Isner in 12 meetings.
The disappointment of failing to create a first match point seemed to weigh on him in the tiebreak and he played it dreadfully, showing rare confusion in going 0-3 down and then losing it 7-4.
"I think we nearly all the time have great matches".
Justice lawyer was told Russia had 'Trump over a barrel'
The FBI had stopped using Steele as a source shortly before the election after he shared information with Mother Jones magazine . Steele also reportedly said that a Trump campaign aide had more contact with Russian officials than had been revealed.
Del Potro admitted the 33-degree temperatures proved a real challenge with the 10-minute heat rule allowing the players a welcome respite after the third set. I don't want to lose against anybody.