Russian second seed Medvedev missed two match points in a gripping deciding-set tie-break before getting over the line at the third time of asking.
"Definitely one of the matches to remember," said the US Open winner, who beat Poland's Hubert Hurkacz in his opening group encounter.
Medvedev now leads Zverev 6-5 in their head-to-head, having also beaten him in the round-robin stage last year.
"Sometimes that's how tennis is," he added. "You just try to do your best. Sometimes luck is on your side, sometimes not."
Medvedev will be guaranteed a semi-final place if Hurkacz beats Jannik Sinner later on Tuesday.
Victory for Hurkacz would set up a winner-takes-all final Red Group clash with Zverev.
Italian rising star Sinner replaced fellow home hope Matteo Berrettini in the draw. The Wimbledon runner-up withdrew due to the abdominal injury which forced him to retire from his first match against Zverev early in the second set.
In front of a large crowd at the Pala Alpitour arena on Tuesday, Medvedev edged the first set thanks to a break in Zverev's opening service game and also saved three break points himself.
World number three Zverev appeared angered by a line call late in that set, before channelling his energy to take the second in a tie-break and level the match.
Medvedev saved a break point in the 11th game of the deciding set to help force another breaker, in which he battled back from 4-2 down to lead 6-4.
He saw two match points come and go but finally clinched a vital win after more than two-and-a-half hours on court.
"That was a match to remember, just amazing," conceded Zverev.
0 Comment(s)