The team from San Francisco had a flashback. It came courtsey of Pablo Sandoval hitting three home runs in the Giants' 13-5 win over the San Diego Padres.

"Actually I did when he hit that third one," Giants Manager Bruce Bochy said. "I said, `that brings back a good memory.'"

Sandoval hit three homers and drove in six runs Wednesday, leading a rare power show by the Giants. It also brought back thoughts of the team's amazing run last fall when it won its second World Series in three years.

Sandoval's only previous three-homer game came in the opener of last year's World Series. He wound up as the MVP of the Series.

Sandoval's thoughts drifted to the most recent Fall Classic as well.

"A little bit," he said. "It was a great moment. Now this is my second time I hit three home runs in a game. It's exciting to me. I'm starting to get my swing back, my timing back and trying to help the team win games.

Sandoval started the day with 10 home runs this season. He then hit a two-run shot in the fifth inning, a leadoff drive in the eighth and a three-run homer in the ninth.

The star third baseman also added a single against the Padres.

San Francisco hit six home runs overall. The Giants began the game tied with Miami for the fewest homers in the majors with 80.

"I think we were all asking where's that from," Bochy said. "But it was good to see them break out because we came out swinging. That is not our game but it shows that we are capable of doing some good things with the bats."

Tim Lincecum (9-13) won again at Petco Park as the Giants avoided the three-game sweep. In Lincecum's first start at San Diego since throwing a no-hitter on July 13, he worked 5 2-3 innings and allowed five runs on seven hits in gaining his third straight win.

"I didn't attack it the way I wanted to," a downcast Lincecum said. "When you have the answers to the test and you don't put them down, it is a little frustrating."

The Giants tagged Eric Stults (8-13), hitting three home runs in taking a 5-2 lead through four innings.

"Obviously I wasn't pleased with the result," Stults said. "Today was a tough one. It was just one of those games that got away from me."

Brandon Crawford homered in the Giants third. Hunter Pence and Hector Sanchez hit two-run homers in the fourth.

Chase Headley and Ronny Cedeno homered for the Padres.

Pence's RBI double finished Stults in the fifth. Sandoval greeted reliever Brad Brach with a towering drive to right.

Stults' second-half woes continued as he absorbed his third straight loss. He last won on July 14 against the Giants.

The Padres pulled to 8-5 on RBI singles by Will Venable and Alexi Amarista in the sixth.

But this day belonged to Sandoval.

"He's one of those guys that when he's hot, he's hot," Padres Manager Bud Black said. "It's really tough to get him out."

NOTES: The Giants' 13 runs were one shy of their season-high; their 17 hits two off their top showing of the season. ... Padres CF Cameron Maybin will undergo season-ending wrist surgery on Friday. He played in only 14 games this year because of knee and wrist injuries. ... Padres 1B Yonder Alonso received an injection in his right hand, which was hurt Friday on a check swing against the Dodgers. ... Headley returned to the lineup after missing six games with a sore back. ... Struggling Giants LHP Barry Zito has been demoted to the bullpen. ... Giants C Buster Posey was out of the lineup and is day to day after spraining his right ring finger on a wild pitch on Tuesday. Bochy was optimistic regarding his availability on Thursday against the Diamondbacks.