The 27-year-old world number three, beaten in his first three Grand Slam finals, started as favourite in this brutal and nerve-jangling match.
But he appeared to have blown his golden chance as he fell two sets behind.
Thiem, who had dropped only one set en route to the final, looked stifled by nerves early on.
But he gradually broke the shackles to hit back from a break down to take the third set.
A limping Thiem trailed 5-3 in a tense decider but Zverev could not close it out and the Austrian summoned some incredible baseline winners to take it into a tie-break.
A gut-wrenching climax saw Thiem squander two match-points from 6-4 with forehand errors.
But he would not be denied, and he set up a third match-point with a passing shot before Zverev fired wide after four hours and two minutes.
“I wish there were two winners today. We both deserved it,” Thiem said on court after a tearful speech from his crestfallen 23-year-old opponent.
He was the second Austrian to win a Grand Slam title after Thomas Muster’s 1995 French Open title.