Corey Perry finally got a puck to bounce right onto his stick. For the first time all year, the former 50-goal scorer got the ensuing shot past a goalie.

And with 5.1 seconds left in another excruciating night for the Anaheim Ducks, Perry gave them reason to believe their season-long run of rotten results might be changing.

More from FoxSports

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

Perry scored his first goal of the season in the waning moments of regulation for the Ducks, who improved to 3-7-2 with a dramatic rally. Last season's Pacific Division champions and Western Conference finalists have been miserable since the season began, but the NHL's lowest-scoring offense and worst power play didn't stop them this time.

"It's been a long time coming," said Perry, who has seven career 25-goal seasons. "You stick with it and you keep pushing, and you try not to get too frustrated. Finally found a bounce and had to make the right shot. It's been a struggle, but if you keep getting chances ... and you stick with it, it's bound to go in at one point."

The Ducks appeared headed to another painful defeat until Brian Campbell high-sticked Perry with 40 seconds left. Anaheim pulled Andersen for the final flurry, and Perry eventually converted the Ducks' 37th shot of the night from the side of Roberto Luongo's net.

Perry dropped to his knees with his arms outstretched in disbelieving celebration, mobbed by his teammates.

Frederik Andersen stopped 23 shots and the Panthers' final three shootout tries, denying Jonathan Huberdeau to end it.

Jakob Silfverberg also scored in the shootout for the Ducks, who have won three straight games at home -- and not any other game all season long.

"It certainly was an important win for us, especially coming from behind, which we hadn't done all year," Anaheim coach Bruce Boudreau said. "I think they're starting to believe a little bit, but until you get (a streak) to three, four, five in a row, it's still a work in progress."

Luongo made 37 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.

Luongo 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.

"It was very frustrating, obviously," Gallant said. "I'm not too happy. You all saw what happened the last five minutes, so what do you do?"

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 last weekend, had roughly 30 friends and family members in attendance, including his grandparents.

"It's exciting, especially with people that have loved me through thick and thin and have gotten me to this point," Grimaldi said. "Family, friends, trainers, all of those people, it's tremendous to play in front of them and it's definitely special, but I wish I would have given them something better with a win instead."

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. Coach Bruce Boudreau had no postgame update on the Swede, who has been one of Anaheim's best forwards this season. ... 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 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.