Dominate the match saved points to end Roger Federer's Clay Trail return and reach the Madrid open semi-finals.
Swiss federalist saved unmatched points at his quarter-end on Thursday but squandered two of his own in the second-pact break-up against thiem.
Austria's Theem eventually came through 3-6 7-6 (13-11) 6-4 to set up a meeting with the world number One Novak Djokovic.
Fifth seed Thyem earlier hit 20-time Grand Slam Champion Federation at the Indian Wells last March.
Four Seder Federer, 37, is playing in his first glue-space tournament for three years.
Them, a predominantly clay-player who lost to Rafael Nadal last year's French Open End, recovered from a slow-paced start to the Springboks.
He made five break points on the Federation's second serve, but the Swiss kept on breaking an eventual tie.
The federal team broke the tie at 8-7 and 10-9 in the tie-break, but the two saved them both and won four of the final five points to make a decision.
Them broke federal early and went to serve the match at second attempt.
He will be playing Dogokovik on Saturday after the Serbee receives a semi-finals forever.
D.Jokovik was set to face Marine Silic but the Kaara pulled out after suffering with food poisoning.