Logan Morrison added a solo home run and RBI triple in Miami's nine-hit attack.
The Marlins have now taken the first two in their four-game set at San Francisco, and they are 3-2 on the road trip.
A night after delivering the decisive two-out, two-run, pinch-hit single in Miami's 2-1 win, Ozuna was again a key contributor Friday. The rookie drove in two runs, and he had a key outfield assist, after he was unable to catch a ball that was ruled an RBI double by Hunter Pence.
"He continues to grind and have good at-bats," Marlins manager Mike Redmond said of Ozuna. "He's had some big hits for us. I know that coming into this series that he'd been struggling. After that big hit last night, he looked really good at the plate."
In the eighth inning, the 22-year-old slapped an RBI single to right field off Jean Machi to put the Marlins in front. Dobbs added a pinch-hit, run-scoring single to give Miami a two-run cushion. The third run of the inning scored on Adeiny Hechavarria's infield single. But on the play, shortstop Joaquin Arias' throwing error allowed Ozuna to score from second.
Steve Cishek locked down his 12th save and second in two nights. It was tricky, as he gave up two singles, but he retired Buster Posey on a ground ball to third for the final out.
A.J. Ramos worked a scoreless seventh inning, and the right-hander picked up his first big league win the night after Tom Koehler celebrated his first victory.
"Obviously, it's something that I've wanted as a young kid, to get a Major League win," Ramos said. "Now that it's here, it's a good feeling.
"I saw Koehler and he looked like he was having a good time winning. I said, 'I wanted to do that, too.' I went ahead and had the opportunity, and it worked out. It just happened to be the next day."
Marlins starter Ricky Nolasco carried a 4-0 record with an 0.87 ERA at AT&T Park into the game. But he didn't factor into the decision, exiting after allowing three runs in 5 2/3 innings.
"It was a battle out there," Nolasco said. "You're not going to have your best stuff every game. You go out there, compete and try to keep your team in the game. I felt like I did that for the most part, whether it was ugly or pretty. Just go out there trying to make pitches. I think I did a good job limiting damage."
San Francisco countered with Tim Lincecum, who came into the contest 2-1 with a 3.67 ERA in four previous starts against the Marlins. Like Nolasco, he wasn't part of the decision, giving up three runs with eight strikeouts in seven innings.
After falling behind 3-1, the Marlins pulled even in the sixth inning on Morrison's two-out RBI triple and Ozuna's infield single that deflected off Lincecum's foot.
In the third inning, the Giants took the lead on Marco Scutaro's opposite-field double, making it 2-1. And in the fifth inning, a two-out RBI double by Pence opened a two-run San Francisco advantage.
On Pence's double, Nolasco encountered some bad luck. Posey was on first, and Pence lofted a floater to short center. Ozuna charged and was in position to make the play, but couldn't make the catch. It was ruled a two-base hit.
"I felt bad," Ozuna said. "I didn't want to see my pitcher give up runs because of me."
After the game, Redmond joked that Ozuna may not have made the catch because he was full after feasting at In-N-Out Burger.
"I think he had about four or five In-N-Out burgers," Redmond said. "I said, 'Maybe that was the reason why you couldn't catch that ball.' I said, 'You got a big hit, so I forgot about it already.'"
Ozuna corrected, saying he had three burgers, three chocolate chip cookies and apple juice.
Ozuna did step up defensively in the sixth inning to help keep the score at 3. Andres Torres doubled high off the wall in right field, and the ball caromed away from Giancarlo Stanton toward center. Torres raced toward third, but Ozuna retrieved the ball and made a perfect throw to third to nab Torres. It was the rookie's sixth outfield assist.
"It looked like Andres saw it, and it looked like he was going to make it," Giants manager Bruce Bochy said. "Then their center fielder made a great throw and put it right on the money. He made a nice throw right on the bag and he got him."