Nolasco (3-0) improved to 4-0 in his career at AT&T Park with a 0.87 ERA there.
"Maybe it's just coming back to California, seeing some family and being on this side," said Nolasco, whose home is in Rialto. "I have no idea why. But I like it."
After dropping three of four to the D-backs at Marlins Park, Miami will take comfort if its starting pitcher feels right at home in San Francisco.
Nolasco, Edward Mujica and Heath Bell combined to limit the Giants to one run as the Marlins opened their nine-game road trip on a winning note.
They needed superb pitching because Cain (1-2) was also impressive, giving up two runs in eight innings.
Nolasco remained in line for the win because Mujica was able to execute the biggest pitch of the night, and perhaps a pitch that will reverse Miami's sputtering season.
With the bases loaded in the eighth, Mujica threw a fastball away to Buster Posey. The one pitch was enough for collect two huge outs.
"I just tried to make a ground ball," Mujica said. "That's what I did. I just tried to throw my stuff. I threw a couple of sliders and a fastball away, I got a ground ball and a double play that saves us. That's one for Ricky."
Pinch-hitter Gregor Blanco doubled to open the eighth. Angel Pagan dropped a sacrifice bunt, and he was safe at first when catcher Brett Hayes' throw to first was in the dirt. With one out, Pablo Sandoval, who homered in the sixth, was intentionally walked to load the bases, ending Nolasco's night.
On a 2-1 pitch, Posey tapped into an inning-ending 4-6-3 double play.
"Ideally, in that situation the last thing you want to do is put the ball on the ground," Posey said. "Unfortunately, that's what happened. For me, I'm just looking to try to stay in the middle of the field and put the ball in the air."
Bell polished off the ninth, retiring the side in order to collect his third save in six chances.
"The most important part was Heath Bell coming in and being aggressive," Nolasco said. "We need that guy badly. It was a great job to come in and be aggressive like he did, throw strikes. And, obviously, Mujica comes in and does a great job, makes that pitch against Posey."
The win improved Nolasco's career record to 67-51. The right-hander is now one win shy of matching Dontrelle Willis' franchise mark of 68.
Cain was perfect through three innings, needing 28 total pitches to retire the first nine batters he faced.
But in the fourth inning, Jose Reyes drew a walk, and the Marlins were able to manufacture a run. Reyes swiped second and advanced to third on Cain's wild pitch. The Giants pulled their infield in for Hanley Ramirez, who whistled a one-hopper just past diving second baseman Ryan Theriot for an RBI single.
The run snapped Cain's scoreless-innings streak at AT&T Park this year at 21 innings.
Cain needed 21 pitches to get through the Miami fourth.
The Marlins made it 2-0 in the fifth on Stanton's leadoff homer, a liner that cleared the 339 sign in left field. It was the slugger's second home run in three games.
Considering how the ball hasn't traveled particularly well at Marlins Park, Stanton wasn't sure if his home run would have enough height to clear the wall.
"It had top-spin, so I didn't know if it was going to hit the top of the wall or not," Stanton said. "We were just at home, so you've got to double-check everything."
San Francisco stranded runners on third in the fourth and fifth innings, but cashed in for a run in the sixth on Sandoval's one-out home run.
The laser shot that cleared the high wall in right field happened to be the only run the Marlins' pitchers allowed on a night the team won for the second time in 10 games.
"The ball bounced our way today," manager Ozzie Guillen said. "We got a double play, the ball hit right at him. I didn't think of the double play. I was thinking of keeping it a tie game. But we continue to pitch well. Our starting pitchers have pitched great."