Zverev held on to beat the Swiss 6-3 6-7(7) 6-3 at the quarter-final stage at the Qizhong Forest Sports City Arena in what was a testy affair.
Federer repeatedly lost his cool with the umpire and general situation, something it is extremely rare to see.
'I liked what Novak said' - Medvedev backs Djokovic over vaccine being 'personal'
The 38-year-old was deducted a point when 3-0 down in the deciding set against the German in a tense stand-off with the umpire.
There was a gasp when the umpire announced: "Code violation. Unsportsmanlike conduct, point penalty, Mr Federer."
All very strange, and now the Swiss legend is out.
Federer, Murray fall in major ranking shake-up; Norrie, Badosa into top 15
‘I don’t have her number but…!’ – Murray responds after Swiatek calls him dream hitting partner