Chasing a deep drive with the game in the balance, Florida Marlins center fielder Dewayne Wise had time to think about how badly his team had been playing lately.

Wise retreated to the edge of the warning track, turned, stumbled and reached out as he fell to make a circus catch. The ninth-inning grab helped the Marlins hang on to snap a seven-game losing streak Friday by beating the San Francisco Giants 2-1.

"I thought, 'Oh my God, with the way we've been playing this homestand ...'" Wise said. "As I was falling I was saying, 'I've got to catch it.' If I don't, it's a tie game at least, and we're probably still playing."

The erratic Marlins had been 0-7 on their homestand, but Ricky Nolasco (9-8) barely outpitched All-Star Matt Cain (9-9). Nolasco allowed one run in eight innings, and Leo Nunez earned his 32nd save in 36 chances by pitching the eventful ninth.

Nunez gave up a leadoff single to Pablo Sandoval, and with one out Cody Ross hit a drive to deep center. Wise — a ninth-inning defensive replacement with a reputation for spectacular catches — ran a buttonhook pattern before making the lunging grab.

"He falls down, you like your chances there," Giants manager Bruce Bochy said. "But he made a great catch."

After the game, Wise stood at his locker smiling as he listened to a description of the play by teammate Logan Morrison.

"When Ross hit it, it was, 'Oh crap,'" Morrison said. "Then it was, 'Oh, he's got a bead on it.' Then it was, 'Oh crap, he's falling down.' Then, 'Ah, he made the catch.' It wasn't exactly the perfect graceful catch, but we'll take it for sure."

Florida improved to 4-0 this season against the defending World Series champions.

The Giants set a major league record for consecutive solo home runs when Sandoval hit one in the first inning. Their past 20 homers have been solo shots, breaking the record of 19 set by the Philadelphia Phillies in 1914.

The lead was brief, because two of the first three Florida batters scored against Cain. He then settled down to pitch six innings, allowing no more runs, but lost his third start in a row.

Nolasco gave up six hits, but the only walk he allowed was intentional, and he benefited from good defense. San Francisco hit into two double plays and lost another runner when Aubrey Huff was thrown out trying to steal.

"The defense will make better plays when you throw more strikes," Nolasco said. "I was trying to do that and keep them on their toes."

There was no evidence of lingering ill will between the teams, who met for the first time since their series in May, when Giants catcher Buster Posey broke his leg in a collision with Florida's Scott Cousins. Cousins is on the disabled list himself with an injury unrelated to the collision, and before the game both managers said their teams wanted to move beyond the episode.

The Giants, starting a 10-game trip, lost for the 12th time in 17 games and continued to sputter on offense. They're next to last in the majors in runs and have totaled 15 in the past eight games.

"We've said quite a few times during the stretch that we're better than this," Bochy said. "But we have to show it."

The top of the order went 0 for 7, and Ross went 0 for 4 playing in Miami for the first time since the Giants acquired him from Florida on a waiver claim last August.

Sandoval gave San Francisco a brief lead when he hit his 14th homer with two out in the first.

Florida came back with two runs in the first on three consecutive one-out hits. Alfredo Amezaga singled, Morrison tripled and Mike Stanton singled.

"It ended up being my fault that we lost," Cain said. "I've got to make better pitches early."

The Giants didn't advance a runner beyond first base in the final six innings.

Notes: Giants OF Carlos Beltran (strained right hand) missed his fourth consecutive game. Bochy didn't rule out putting Beltran on the disabled list but said the Giants hope he'll heal quickly after he received a shot. ... Giants OF Nate Schierholtz, who had been sidelined with a right hip flexor, struck out pinch-hitting in the eighth. ... Marlins CF Mike Cameron (knee) was scratched from the starting lineup. ... Florida RHP Javier Vazquez returned from Puerto Rico, where his wife was ill, and he'll start Saturday. RHP Chris Volstad, recalled from Triple-A New Orleans, will make his first start since July 22 on Sunday. ... Giants RHP Tim Lincecum, scheduled to start Saturday, is 5-4 with a 1.67 ERA over his past 10 starts.