Medvedev, who won the U.S. Open in September for his first Grand Slam title, took just over 2 1/2 hours to beat Zverev 6-3, 6-7 (3), 7-6 (6) and move level with the German on a tour-leading 56 wins after a tense tiebreaker in the decisive set.
"Definitely one of the matches to remember,'' Medvedev said. "When you win 8-6 in the tiebreak in the third, it was 4-2 for him so I was like OK, he serves a few aces it's done. I made it 6-4 and I was like OK, that's my moment now. It's back to 6-6 ... Just an amazing feeling. Not actually much to say about the match, just amazing.''
Medvedev leads Red Group and was assured of his place in the final four after Berrettini pulled out of the tournament. Berrettini retired against Zverev on Sunday with an abdominal injury and although he trained Tuesday he could not recover in time and was replaced by Sinner - the first alternate.
Helped by fast conditions inside the Pala Alpitour, Medvedev served 14 aces and Zverev 18.
Medvedev was in a fight from the start, fending off three break points in his opening two service games but also breaking Zverev to take a 3-0 lead. The world No. 2 went on to win the opening set with a delightful backhand down the line.
Victory looked in good time in the second set as Medvedev dropped only two points in his first five service games. But Zverev held on and saved three break points to force the tiebreaker which the German won.
In the deciding set, Medvedev had to save a break point to prevent Zverev from serving for the match, and he won the tiebreaker on his third match point when Zverev netted a backhand.
Medvedev will face Sinner in the final group match and despite having played a match less than his rivals, the young Italian can still reach the final four.
The 20-year-old Sinner showed no signs of nerves as he won 6-2, 6-2, breaking his opponent's serve twice in each set and sealing the result when Hurkacz sent a forehand long _ much to the delight of the passionate home crowd.
Instead of signing his name on a TV camera as most winners do, Sinner wrote: "Matteo sei un idolo'' (Matteo you're an idol).