Schwartzman, of Argentina, was two points from defeat on three occasions in the fourth set but eventually pulled out the 7-6 (1), 5-7, 6-7 (6), 7-6 (5), 6-2 victory by taking the last four games.
The 12th-seeded Schwartzman had been 0-3 in major quarterfinals until this one against No. 3 Thiem, of Austria, who was trying to reach the final four at Roland Garros for the fifth consecutive year.
Schwartzman could have ended things much sooner. He was two points from taking the second set, then one point from grabbing the third. But Thiem kept fighting back and eventually was two points from winning at 6-5 in the fourth set and again in that tiebreaker.
Schwartzman broke to go up 4-2 in the fifth when Thiem netted a backhand, and again to end it, when Thiem put two drop shots into the net.
Alexander Zverev posted a screenshot of his negative test for the coronavirus on his social media feed on Monday, putting to rest fears that he played his fourth-round match at the French Open while infected by COVID-19.
Those concerns were triggered by Zverev saying that he was hampered by a fever and respiratory difficulties following his loss to Sinner.
“I wanted to update everyone that I have again tested negative for COVID,” Zverev wrote. “I wasn’t 100% yesterday and will now take a few days to recover.”
Information from The Associated Press was used in this report.