Two dramatic goals 30 seconds apart in the third period have sent the Sharks into the Stanley Cup playoffs for a ninth consecutive season.

San Jose came from behind to defeat the Dallas Stars 3-2 at HP Pavilion on Tuesday night in the final home game of the regular season. The Sharks had been trailing with less than six minutes remaining, but Joe Pavelski's deflection of a shot by Brad Stuart tied things at 14:23 and Logan Couture scored the winner on the next shift.

"Basically a full game of frustration turned into happiness with the go-ahead one there," Couture said. "As soon as the final horn sounded and we got the two points and knew that we were going to the playoffs, big smiles."

The postseason was anything but a certainty one month ago, when the Sharks found themselves in ninth place. But a 12-3-1 record down the stretch put them in position where they needed only one point against Dallas to keep playing after the regular season ends Saturday night.

The victory gives the Sharks 57 points for the season, tying them with the Los Angeles Kings for fourth place. If San Jose wins its final two road games -- Wednesday night against the Phoenix Coyotes and Saturday night in Los Angeles -- the Sharks will open the first round of the playoffs at home.

"That would be a nice thing to have," coach Todd McLellan said -- an understatement since San Jose finished the regular season 17-2-5 at HP Pavilion.

Raffi Torres scored the Sharks' first goal on a power play in the opening period, but Antoine Roussel matched that at even strength and Loui Eriksson had staked Dallas to a 2-1 lead 17 seconds into the middle period while both Brad Stuart and Marc-Edouard Vlasic were in the penalty box.

That looked like it might hold as Stars netminder Kari Lehtonen -- with the help of the crossbar and post -- stood tall until the late heroics.

Pavelski said he seemed to sense it coming.

"You're at home, the crowd is building and building and you're just waiting for it to blow," he said. "It was an awesome atmosphere out there."