Porter stole the puck from Sharks defenseman Kent Huskins, sped into the San Jose zone and fired the puck behind goalie Antero Niittymaki.
"We knew we were going to win once we got into overtime," Porter said.
The loss ended the Sharks' winning streak at four games.
Badly outplayed and trailing 3-1 after two periods, the Avalanche tied the game on third-period goals from Chris Stewart and Paul Stastny on shots that came 6:11 apart.
Stastny forged a 3-3 tie at 14:49 with a shot from the right faceoff circle that sailed past Niittymaki, who was screened on the play.
Stewart pulled the Avalanche within a goal at 8:38 when he burst down right wing and overpowered Niittymaki with a hard shot.
San Jose outshot Colorado 30-11 over the second and third periods and 43-20 through regulation.
"I was happy with our guys, believe it or not," Sharks coach Todd McLellan said. "We lost the game and that's the real disappointing thing. But for the most part, I thought we played a real solid game. They scored a couple of goals at fortunate times for them."
Boyle whipped a one-timer behind Avalanche goalie Peter Budaj at 1:09 of the second period to break a 1-1 tie after taking a pass from Joe Thornton.
Moore, playing in his second NHL game, scored his first NHL goal at 9:14 to increase the Sharks' advantage. A 25-year-old defenseman, Moore accepted a pass from Dany Heatley and launched a long shot that skimmed between the pads of Budaj, who was partially screened.
The Avalanche were fortunate to survive a first period that ended in a 1-1 tie.
After giving up a goal less than a minute into the game for the second night in a row – Sharks center Logan Couture scored 42 seconds after the opening faceoff – the Avalanche killed off four consecutive penalties, including a double-minor to Brandon Yip for high sticking.
Colorado tied the game at 18:27 on its only power play of the period, with rookie defenseman Kevin Shattenkirk collecting his first NHL goal. Milan Hejduk got the puck to Shattenkirk, the Avalanche's No. 1 pick (No. 14) at the 2007 Entry Draft, in the left circle for a shot that eluded Niittymaki to the far side.
"We came back in the third and took it to them," Shattenkirk said.