Nadal had won 71 matches in a row when grabbing the opening set, and he served for the victory in Saturday's semifinals when leading 5-4 in the second set. But Medvedev broke at love there and came all the way back to win 3-6, 7-6 (4), 6-3, claiming the last four games.
"It's great that we managed to beat two of the biggest players in the history of the sport,'' Medvedev said. "It's super for tennis."
Thiem frittered away four match points in his semifinal against Djokovic because he was "tight and nervous" during a second-set tiebreaker. Thiem gathered himself, though, and eventually reeled off seven of the match's last eight points after trailing 4-0 in the last tiebreaker, winning 7-5, 6-7 (10), 7-6 (5).
"What he did from 0-4 in the third-set tiebreaker was just unreal,'' said Djokovic, a 17-time Grand Slam champion. "I don't think I played bad. ... He just crushed the ball and everything went in."
Thiem ended Djokovic's bid for a record-tying sixth ATP Finals trophy, while Medvedev prevented Nadal from continuing to pursue the most significant title the 20-time major champ hasn't won.
Instead of a 57th meeting between Djokovic and Nadal, Thiem and Medvedev will face off for the fifth time. Thiem leads 3-1, including a straight-set victory in the US Open semifinals in September en route to the 27-year-old Austrian's first Grand Slam championship.
"I, for sure, can cause him some trouble," Medvedev said.
Did that to Nadal, too.
Nadal seemed on his way to the final when he reeled off four consecutive games in the second set for a chance to serve for the match. He surprisingly stumbled.
"I played a bad game. That's it," said Nadal, who deflected a question about whether he had any physical issues during the match.
Once he was back in the match, Medvedev took advantage, dominating the ensuing tiebreaker with the help of a shanked lob winner, a forehand winner that concluded a 26-stroke exchange and a leaping backhand that drew a netted forehand.
Nadal couldn't shake that off, dropping the match's last three games as he serve-and-volleyed more than usual, sliced his backhand more than usual and made forehand errors more than usual.
Medvedev had been 0-3 against Nadal, including a five-set loss in the 2019 US Open final, and the lanky 24-year-old Russian's top-notch serve, capable backhand and willingness to hang in long baseline rallies provided Saturday's breakthrough.
A year ago, Medvedev went 0-3 in round-robin play at the ATP Finals, while Thiem was the runner-up to Stefanos Tsitsipas.
Whoever wins Sunday on the indoor hard court -- where things will be quiet because spectators are banned because of the coronavirus pandemic -- will be the tournament's sixth different champion over the past six years, the longest such stretch since 1974-79.
It was the first time since 2004 that the top four players in the rankings filled the four semifinal slots for the ATP Finals. Djokovic, already assured of finishing the year at No. 1 for a record-tying sixth time, was trying to match Roger Federer's mark of six ATP Finals trophies.
In the second set against Djokovic, Thiem's ace put him ahead 6-5 in the tiebreaker, one point from victory.
But Djokovic saved that initial chance with a 127 mph service winner. Thiem's next opportunity came at 7-6; he double-faulted.
"I was, like, so tight in my whole body," Thiem said.
The third was at 9-8, when he pushed a down-the-line forehand wide. At 10-9, Djokovic erased No. 4 with a forehand that landed right on a line.
That began a three-point run by Djokovic to steal the set.
But Thiem regrouped, and his 300th career tour-level victory made him only the second man with at least five wins each against the Big Three of Djokovic (5-7 career mark), Federer (5-2) and Nadal (6-9). Andy Murray is the other.
"If you beat these guys," Thiem said, "it gives you a huge boost of confidence."
Note: Mate Pavic and Bruno Soares clinched the year-end No. 1 team ranking for men's doubles when the other contenders, Rajeev Ram and Joe Salisbury, lost in Saturday's semifinals to Jurgen Melzer and Edouard Roger-Vasselin.