The seasoned Argentine recovered to win 3-6, 7-6 (7/5), 6-4 in one hour, 55 minutes against the 20-year-old Zverev and will next play either Viktor Troicki or John Isner.
Zverev was going after his sixth title of an outstanding season and was comfortable in the first set against Del Potro, the 2009 US Open champion and 16th seed.
The German prodigy and the 29-year-old, whose career has been beset by injury, went toe to toe in the second set and the tie break was just as tight until Del Potro grabbed the crucial mini-break.
"Right now I'm very pissed off, as you can probably tell," said Zverev afterwards, having smashed the racquet on the court, then trodden on it, and brutalised it further as he stomped back to his chair.
More From This Section
A fan at least came away with a demolished racquet after Zverev handed it to a spectator.
"I don't understand how I can lose a match where I get broken one time in three sets and not managed to get any chances on his serve," said Zverev, the world number four tipped to one day top the rankings.
Also into the quarters in Shanghai, where Rafael Nadal and Roger Federer were in action later, are sixth seed Grigor Dimitrov and Albert Ramos-Vinolas.
The Bulgarian Dimitrov defeated American Sam Querrey 6-3, 7-6 (7/3) and Spain's Ramos-Vinolas saw off Germany's Jan- Lennard Struff 7-6 (7/4), 6-4.