The 35-year-old Scot produced a performance of customary grit to edge past Zverev 7-6 (5) 2-6 7-5 in a gruelling contest lasting more than three hours.
His reward is a last-eight showdown with French qualifier Alexandre Muller on Thursday.
Speaking on court afterwards, Murray said: “Obviously I would like to win the matches quicker, but Alex is a top player, he’s a great competitor.
“He always fights right to the end – it’s one of his biggest strengths – so even once I got that tight first set, he kept going for it and the third set, I was really hanging on. He was creating more of the chances and was the better player for large parts of that.
“But I managed to stay strong, kept fighting and got the break at the end and closed it out well.”
Murray won the first set on a tie-break after both players surrendered service repeatedly. The German served for the set at 5-4, but Murray dug deep to level and ultimately take it in the breaker.
Zverev’s response was swift as he raced to a 3-0 lead in the second and although the Scot made good use of the new balls to register in the next game, he ultimately went down 6-2 after another break.
Murray kept his opponent at bay to win the fourth game of the third set from 30-40 down and level at 2-2, and he scrapped his way to 5-5.
He produced a stunning drop shot and then forced Zverev to hit long to earn the chance to serve for the match, and having earlier found himself two points from defeat, made no mistake to seal his passage.
Asked about the clash with Muller, Murray said: “He’s obviously had a good week this week. Coming through qualifying, he will have played four matches now, so obviously likes these conditions.
“My coach will obviously watch some video and stuff tonight to get a bit more familiar with his game, but it’s an opportunity for me in the quarters tomorrow and time to rest up and get ready for that one.”
Fellow Briton Liam Brady’s hopes of joining Murray in the quarter-finals were dashed by third seed Daniil Medvedev. Broady gave as good as he got for much of the first set before succumbing 6-4 and lost the second 6-3.