Mager, a qualifier, led 7-6 (4), 2-1 when rain forced the match to be suspended on Friday. He won the second set 7-5 on Saturday to reach the semifinals.
"I am speechless," Mager said. "Playing against him was already a dream. I watch him on TV all the time."
Thiem declined to speak to the media. Defeat also cost him the chance to overtake Roger Federer for the No. 3 world ranking.
The other semifinal features third-seeded Cristian Garin of Chile and fifth-seeded Borna Coric of Croatia.