From being two sets down, the 27-year-old world number three was in all sorts of trouble before hitting back from a break down to take the third.
In a nerve-wracking fourth set, Zverev faltered on serve at 3-4 allowing Thiem to take the contest to a decider.
Thiem then trailed 5-3 in the decider but rode on baseline winners to take it into a tiebreak. He squandered two match points from 6-4 but Zverev fired wide a third opportunity after four hours and two minutes.