The 21-year-old Melzer recorded the biggest win of his three-year career, 6-4, 6-3. He punctuated his first victory over a top-10 player with an ace and will face Jiri Novak of the Czech Republic on Friday.
"It was a great match for me, I'm very happy," Melzer said. "I felt very confident on the court today, it was real fun out there. I tried to play point by point and not to think too much, which worked out great today."
Haas was coming off a three-set win over Russia's Mikhail Youzhny.
"I think I played better today than against Youzhny," the German said. "I was a little bit lucky to have won yesterday. I'm disappointed that I'm not able to defend my title. On the other hand, it was a bonus for me that I could play at all. I've tried all kind of things to cure my shoulder."
Second seed Juan Carlos Ferrero of Spain also was upset in the second round, losing to Czech qualifier Bohdan Ulihrach, 6-4, 6-2.
"I had nothing to lose today and I served very well," said Ulihrach, whose next opponent is sixth seed Roger Federer of Switzerland. "The surface here suits me, I like it a lot. I've played a lot of matches since the U.S. Open, which has helped me a lot. I lost a lot in the first and second round earlier this year."
Ulihrach defeated Ferrero for the first time in four career meetings and prevented the Spaniard from moving further ahead of Britain's Tim Henman for fourth place in the ATP Champions Race.
Federer needed nearly two hours to get past Spain's Tommy Robredo, 6-2, 6-7 (5-7), 6-4.
"It was a tough match, just like I expected," Federer said. "I knew I had to play well to beat him, and that is what I did today. I was a little bit lucky in the third set and I'm happy that I managed to come through."
"I was a little bit sick in the beginning of the week, but now I feel much better," said Pavel, who will face Russia's Nikolay Daydenko in the quarterfinals.