Djokovic had breezed through to the last four without dropping a set as he chased a record-equalling sixth title and a first for six years.
But third seed Zverev, who ended the world number one’s hopes of a Golden Slam by beating him at the Olympics in Tokyo played a superb match to win 7-6 (4) 4-6 6-3.
On Sunday, the 2018 champion will take on last year’s winner Medvedev, who had a straightforward 6-4 6-2 victory against Norwegian debutant Casper Ruud.
Medvedev defeated Zverev in the group stages in a match that went right to the wire and will be the favourite having won their last five meetings.
Zverev knows he has the weapons to beat Djokovic and that confidence shone through as he saved a set point at 5-6 in the opener before playing an exceptional tie-break.
Rarely can Djokovic have lost a set where he has played at such a high level, and he seemed rattled in the early stages of the second but responded in trademark fashion to level the match.
A sloppy game early in the third was uncharacteristic, though, and Zverev held firm on his own serve to clinch a fourth career win over the Serbian.
Joe Salisbury made some British history by becoming the first player from these shores to reach the doubles final at the ATP Finals.
Salisbury and American Rajeev Ram have had another brilliant season, capped by their second grand slam title at the US Open, and they came from a set down to claim a 4-6 7-6 (3) 10-4 victory over top seeds Nikola Mektic and Mate Pavic in Turin.
Having let a 7-1 lead slip in the deciding tie-break at the same stage last year against Jurgen Melzer and Edouard Roger-Vasselin, Salisbury and Ram ensured they did not make the same mistake this time.
Salisbury is looking to follow in the footsteps of 2016 singles champion Andy Murray who is the only previous British winner of the event.
Salisbury was unaware of his history-making moment, saying: “It obviously makes it extra special. Hopefully there will be a lot more.
“It’s a big achievement. Obviously really, really proud of it. But I don’t want to be just a Brit getting to the final, I want to be the one winning it. We’re enjoying the win right now, but we’re going to be back to business soon, really focusing on the match tomorrow and getting the title.”
Register for free to continue reading
Registration is a free and easy way to support our truly independent journalism
By registering, you will also enjoy limited access to Premium articles, exclusive newsletters, commenting, and virtual events with our leading journalists
Already have an account? sign in