The Argentinian was staring down the barrel of defeat when he lost the opening set and trailed 5-2 in the second, with Davidovich Fokina unable to convert a match point.
After his opponent failed to capitalise, Schwartzman recovered to win 2-6 7-6 (7-3) 6-1 to set up a semi-final with either Felix Auger-Aliassime or Yoshihito Nishioka.
Schwartzman is aiming to secure one of the final two spots for the ATP Finals and occupies the final qualifying berth.
"Tennis sometimes is crazy," Schwartzman said after the match. "Maybe today I got lucky to be here answering questions.
"But that is why I am here as well with this ranking, because I am always trying to find a way to win the matches. Today was not the exception to the rule."
Home favourite and top seed Alexander Zverev came through in three sets, beating Adrian Mannarino 6-4 6-7 (5-7) 6-4. He meets Jannik Sinner, who recovered from losing eight straight games to defeat Gilles Simon 6-3 0-6 6-4, in the other last-four match.
At the European Open, Dan Evans saved match point en route to ousting third seed Karen Khachanov 3-6 7-6 (9-7) 6-4 and will go up against Ugo Humbert in the semi-finals after the Frenchman beat Lloyd Harris in straight sets.
Australia's Alex de Minaur hammered Marcos Giron 6-3 6-0 in under an hour and faces Grigor Dimitrov next, with the Bulgarian handed a walkover after Milos Raonic withdrew before the match because of an abdominal strain.