Stanton's power picked up the club, which claimed its first road series of the season.
"It's what I've been waiting on for a month now," said Stanton, who had one home run in April. "I never really got down on myself for not hitting homers or none of that. I knew it was going to come around sometime. It's finally here."
The big hit came on a night the Marlins didn't take better advantage of 10 walks, and the club was unable to lock down the first win of the year for Carlos Zambrano, who threw seven shutout innings.
The night also included another rough appearance for closer Heath Bell, who was charged with two runs while not recording an out in the ninth. Manager Ozzie Guillen took the ball from Bell in a 2-1 game with runners at the corners at no outs.
Steve Cishek inherited difficult circumstances, but came through in a huge way, forcing extra innings. The right-hander was charged with a blown save, but then was credited with the win.
"The biggest thing is the team won," Bell said. "Tonight, Ozzie made a good decision. It worked out for us.
"Shek came in and did an unbelievable job. Stanton picked me up big time right there. I just feel really bad because Zambrano pitched one heck of a game and got nothing for it. My teammates picked me up. We won as a team yesterday."
Bell entered in the ninth inning looking to protect a two-run lead. Instead, the veteran endured more frustration. The Giants rallied back with a broken-bat double by Brandon Belt and RBI single by Joaquin Arias. Buster Posey delivered a pinch-hit single to right, putting runners on the corners with no outs. Emmanuel Burriss ran for Posey.
Bell, who has blown three of six save chances, was replaced by Cishek. The side-arm throwing right-hander struck out pinch-hitter Brett Pill. But the Giants were able to tie it on Gregor Blanco's squeeze-bunt RBI single, which was fielded by first baseman Gaby Sanchez, who was unable to make a throw to the plate.
Cishek was able to push the game to the 10th by getting Ryan Theriot to bounce to second with the bases loaded.
"I tried to keep the ball down," said Cishek, a 25-year-old who has the makings of being a future closer. "Thankfully, I got the strikeout early. And kept the ball in the infield. They made a great bunt, but it all worked out at the end."
In an hostile environment, Cishek stayed calm, improved his record to 3-0 and lowered his ERA to 0.79.
"You just can't let that stuff bother you," Cishek said of pitching through adversity. "You have to go pitch by pitch. If you let that stuff bother you, the other team sees it, and you're done. Also, I have to be able to put that stuff out of the way and concentrate on what pitch you're going to throw next."
Before the two-run lead disappeared in the ninth, Carlos Zambrano was lined up for his first win as a Marlin. The veteran held the Giants scoreless for seven innings.
Zambrano turned in his longest scoreless outing since throwing eight shutout innings against the Padres on April 18, 2011. The right-hander, then with the Cubs, fanned 10.
After the game, Zambrano made it a point to give Bell some encouraging words.
"He said, 'Sorry Z.' I said, 'Don't worry, just keep your head up. We won the game, that's the most important thing. Keep your head up. Things will turn around,'" Zambrano said. "That's what I told him."
Omar Infante had a first-inning RBI on a fielder's choice, and an error accounted for Miami's second run.
Giants lefty Barry Zito was wild in 3 2/3 innings, walking seven while allowing two hits. The Marlins scored twice off the veteran, with one run unearned.
The Marlins manufactured runs in each of the first two innings.
Emilio Bonifacio drew a one-out walk, and moved to second on Hanley Ramirez's single to left. A passed ball charged to Hector Sanchez moved both runners into scoring position, and Austin Kearns walked to load the bases.
The Marlins got on the board on Infante's fielder's choice grounder that was bobbled by shortstop Brandon Crawford, which cost the Giants a potential inning-ending double play. Bonifacio scored on the play, marking the first Miami run in the first inning since April 19 against the Cubs, a span of 11 games.
"I think those guys fought through it the whole game," Guillen said after the Marlins won for the fifth straight time in San Francisco in the past two years. "I think they did a tremendous job getting Zito out of the game. We were swinging at strikes and taking walks. Obviously, we left a lot of guys on base today."