Pagan and Melky Cabrera each drove in four runs to back Ryan Vogelsong's 6 1/3-inning effort. Vogelsong improved to 3-1 with a 1.56 ERA in May.
The Giants' ninth victory in 13 games brought them into uncharted territory besides the Marlins' new playpen. They established a single-game season high for scoring. They at least temporarily interrupted the dominance of the Marlins, who entered the game with the Majors' best record in May (16-6) and had won eight of the teams' last 10 meetings.
And the Giants finally overcame Sanchez (2-3), who began the game with a 3-0 record, two shutouts and a 0.87 ERA against them in four previous starts.
"He's not quite as tough as [Clayton] Kershaw," Vogelsong said, citing the Giants' leading nemesis from the archrival Los Angeles Dodgers. "But he's pretty darn close."
"Believe me, I'm as shocked as anybody," Giants manager Bruce Bochy said. "I thought it was going to be a low-scoring game, which it was."
Until the sixth, that is. With the score deadlocked at 1, Gregor Blanco opened the inning by tripling to left field. One out later, Blanco nearly erased himself from the basepaths by breaking for home on Cabrera's low liner that caromed off Sanchez's left wrist. Sanchez quickly recovered the ball and threw it to catcher Brett Hayes, who chased Blanco toward third base before firing a relay there. But Blanco dove around third baseman Hanley Ramirez and clutched the bag with his right hand to return safely. Cabrera reached first base.
Buster Posey walked before Pagan whipped Sanchez's first pitch into right field, scoring Blanco and Cabrera. Posey scored on a wild pitch before Brandon Belt's bloop single chased across Pagan and finished Sanchez.
"We hit a couple of balls not very hard, but in the right place," Bochy said.
The inning, and perhaps the evening's outcome, revolved around Blanco's desperate, successful scramble back to third base. Had he been trapped, the Giants would have had two outs with a runner on first, and the rally likely would have fallen flat.
"That's probably what won the game for us," Bochy said.
Marlins manager Ozzie Guillen agreed.
"One little play turned the game," he said. "The rundown at third base could have made the game change."
San Francisco added three runs in the seventh on Cabrera's two-run double and Pagan's fielder's-choice grounder. That helped fend off the Marlins, who scored twice in their half of the seventh.
Cabrera contributed another two-run double in a four-run eighth. His 3-for-5 performance hiked his May batting average to .421 (40-for-95) and his overall hit total to 67, both tops in the Majors. Cabrera also lengthened his hitting streak to eight games.
"Every day, I work as hard as I can to prepare myself to take good at-bats," Cabrera said, with second baseman Emmanuel Burriss translating.
The Giants haven't witnessed such consistency since Randy Winn batted .447 and rapped 51 hits in September 2005.
"Melky's unbelievable," Vogelsong said. "He has done nothing but impress everybody in this room since he got here."
Vogelsong did his share to hike the Giants' record on this seven-game trip to 3-1. With the bases loaded and two outs in the fifth, he had to confront Giancarlo Stanton, who opened the scoring in the second inning with a typically mammoth home run that traveled an estimated 434 feet. But Vogelsong coaxed a foul popup from Stanton on a fastball -- the same pitch the slugger clobbered into a beer stand three innings earlier.
"It wasn't where I wanted it," said Vogelsong, ever the perfectionist.
But it was low, which complemented a night full of highs for the Giants.