The 12th-ranked Melzer held on when Haider-Maurer served for the match at 5-3 in the second set and forced a tiebreaker. Melzer is the first player to successfully defend the title in Vienna since Ivan Ljubicic in 2005-06.
Haider-Maurer, who had never advanced to the quarterfinals, double-faulted twice and hit two unforced errors to let Melzer back into the match.
"It was very, very close," Melzer said. "I just hoped that Andy would start thinking about winning and would get nervous and that's exactly what happened."
The 157th-ranked Haider-Maurer reached his first ATP final. He's the lowest-ranked player to reach a final this season.
"He's among the best players in the world and played fantastic in the third set," said Haider-Maurer, who had pulled out of qualification with a thigh injury before entering the main draw as a replacement for Ernests Gulbis.
As a result of reaching the final, he will enter the top 120 when rankings are announced Monday.
"It's all still a dream to me," the 23-year-old Austrian said. "Obviously, my next goal is getting in the top-100. When I keep playing on this level, it should be just a matter of time."