With his team ahead 1-0 entering the frame, the Wild's Mikko Koivu lost the puck in his own end and it went right to Hagman, who rolled a shot up over the back of goalie Josh Harding and into the net 8:17 into the frame.
Perry gave Anaheim the lead 4 minutes later when he beat Harding to the short side, and the Ducks held on for their fourth win in five games.
Jonas Hiller earned the victory by stopping 17-of-18 shots.
The Wild lost their fifth straight and 20th in 25 contests.
Dany Heatley scored and Harding finished with 23 saves for Minnesota.