Florida Panthers defenseman Willie Mitchell (33) helps goalie Roberto Luongo (1) defend the goal against Anaheim Ducks right wing Chris Stewart (29) during the second period.

Gary A. Vasquez USA TODAY Sports

ANAHEIM, Calif. (AP) -- Chris Stewart scored in the second period and again in the fourth round of the shootout, and the Anaheim Ducks beat the Florida Panthers 3-2 Wednesday night for their first consecutive victories of the season.

Corey Perry tied it on his first goal of the season with 5.1 seconds left in regulation for the Ducks, who improved to 3-7-2 with a dramatic rally.

More from FoxSports

Frederik Andersen stopped 23 shots for Anaheim, denying Jonathan Huberdeau on the decisive shootout try.

Jakob Silfverberg also scored in the shootout for the Ducks, who could be turning around their nightmare start with the NHL's lowest-scoring offense and worst power play.

Roberto Luongo made 36 saves in a strong performance for Florida. Erik Gudbranson and Orange County native Rocco Grimaldi scored as the Panthers opened a three-game California road trip with a heartbreaking loss.

The Ducks appeared headed to another narrow defeat until Brian Campbell high-sticked Perry with 40 seconds left. Anaheim pulled Andersen for the final flurry, and Perry eventually converted Anaheim's 37th shot of the night from the side of Luongo's net, dropping to his knees with his arms outstretched in disbelieving celebration.

Luongo was outstanding for the Panthers, but was denied just his second victory since Oct. 15 after a wild overtime period. Florida coach Gerard Gallant angrily protested the key penalty call against Campbell.

Jaromir Jagr returned from a two-game absence with an upper-body injury for Florida, facing the Ducks for the first time since December 2013.

Grimaldi opened the scoring by deflecting a shot off Cam Fowler's skate for his first goal of the season. Grimaldi, recalled from the minors on Halloween, had roughly 30 friends and family members in attendance to watch his first goal at Honda Center.

Stewart evened it less than three minutes later with an excellent shot into Luongo's top corner at a sharp angle.

Gudbranson got his first goal of the season late in the second when Andersen whiffed on the defenseman's long shot. Gudbranson's goal was his first in 26 games since March 7.

NOTES: Ducks F Rickard Rakell left with an upper-body injury in the second period. ... Grimaldi was born in Anaheim and grew up in nearby Rossmoor, and he attended Ducks games as a kid before moving away for junior hockey. ... Ducks captain Ryan Getzlaf missed his fourth straight game after an appendectomy.