Matt Cain used to be San Francisco's hard-luck loser, seemingly never getting the run support he needed. He had finally begun to shed that stigma this season and had a nice new contract as a vote of confidence — not to mention 18 straight scoreless innings over his first two home starts.

Then, his Giants missed more chances in what has become a disturbing trend for manager Bruce Bochy's bunch.

Giancarlo Stanton homered for the second time in three games to help back Ricky Nolasco's third straight win, and the Marlins beat Cain and the Giants 2-1 on Tuesday night for just their second victory in 10 games.

Hanley Ramirez had an RBI single in the fourth that ended Cain's home scoreless streak to start the season at 21 innings.

Nolasco (3-0) outdueled Cain (1-2) in the Marlins' sixth victory against the Giants in their last eight meetings — a stretch that includes Nolasco's 2-1 win over Cain last Aug. 12 in South Florida.

"I just made a couple of more mistakes than he did," Cain said. "Sometimes you feel like you get yourself in the right situations and you don't get it done."

Struggling Miami closer Heath Bell pitched a 1-2-3 ninth for his third save in six chances and first since walking a career-high four batters and taking his third loss Thursday in a 3-2 road loss to the Mets.

Pablo Sandoval hit a solo home run in the sixth for his fifth of the year and also doubled in the fourth for the Giants, who couldn't capitalize on chances.

A few hours after manager Ozzie Guillen insisted he would begin making lineup changes in the coming days if the Marlins don't get back on track, Miami stole three bases and challenged and worked the count against Cain. And Bell came through after Guillen said he would even consider a switch at closer if the burly right-hander didn't start producing.

Ryan Theriot's sharp grounder with two outs that bounced over the bag at first was ruled foul, and manager Bruce Bochy came out to argue. Theriot then grounded out to end the game.

"It's tough. Obviously a big point in the game," Theriot said. "We'd got a guy on second in the ninth and anything can happen, especially at home."

And, as the struggles continued one day to the next, Guillen began inquiring about extra insurance to protect himself.

"Your fans boo you, for good reason, for the right reason, it was starting to get ugly," Guillen said. "Hopefully we play better tomorrow than we did today, because my wife has very bad insurance. I've got to make sure I put my money in my insurance because if we keep playing like that, I might not make it to July."

Cain allowed two runs on six hits in eight innings, struck out four and walked one.

The right-hander had been nearly unhittable at home so far. He pitched a one-hitter in a 5-0 win over Pittsburgh in the home opener April 13, then pitched another nine scoreless innings in a 1-0, 11-inning victory against the Phillies and Cliff Lee — Philadelphia's ace went 10 scoreless — on April 18.

"It sure is a tough one for Matt. He gives up two runs in eight innings. He did his job," Bochy said. "Watching Theriot's reaction, he thought it was fair. That was a bad break. Still, we had our chances and didn't come through."

San Francisco leadoff man Angel Pagan extended his career-high hitting streak to 15 games with a third-inning single, then reached on an error in the eighth while sacrificing Gregor Blanco to third after his pinch-hit double. With no outs, Nolasco retired Melky Cabrera on a grounder to first before intentionally walking Sandoval to load the bases.

Edward Mujica relieved and got Posey to ground into an inning-ending double play.

"That's a situation more times than not you're going to get runs," Cain said.

In the series opener, there was hardly the same drama these clubs endured when they played here last May.

This marked Posey's first time facing the Marlins since the catcher's season ended with left leg and ankle injuries in a collision at the plate on May 25, 2011, with the Marlins' Scott Cousins.

Posey, the 2010 NL Rookie of the Year, is healthy and thriving and Cousins is trying to make his own comeback form injury with Triple-A New Orleans.

The Marlins swept that three-game series at AT&T Park. Now, the new-look, big-spending Miami club (9-14) is trying to dig itself out of last place in the NL East with the outspoken Guillen calling for his players to do everything better or face sweeping changes.

Nolasco allowed seven hits in 7 1-3 innings, struck out one and walked one. He improved to 4-0 at AT&T Park with a 0.87 ERA, and owns a 1.56 overall ERA against the Giants.

Notes: San Francisco's Aubrey Huff, on the 15-day disabled list with anxiety disorder, took early batting practice under the watchful eye of Bochy. Huff is expected to come off the DL when eligible ... Giants LHP reliever Dan Runzler, on the DL to start the season with a strained lat muscle, returned to the Bay Area from rehabbing in Arizona to be seen by team orthopedist Dr. Ken Akizuki because of what Bochy called a "minor setback." ... San Francisco LHP Jeremy Affeldt went on the DL after spraining his right knee when his 60-pound, 4-year-old son, Walker, jumped into his arms off a couch Saturday night — Affeldt's second non-baseball injury in less than eight months. Last Sept. 8, he sliced his non-throwing hand while separating frozen hamburgers.