MILWAUKEE -- The first inning set the tone for a long, wild night at Miller Park.

Both teams batted around in the opening frame -- the first time that's happened in Major League Baseball this season -- and both teams squandered big leads before the Brewers finally put away the Giants, 13-12, on Friday.

On a night that featured 25 combined runs and 31 hits, it was a soft ground ball and some heads-up baserunning that won the game for Milwaukee. And let's just say that the runner in question is not exactly a threat to win the stolen base crown.

"He's not Carl Lewis out there," manager Ned Yost cracked.

Yost's gentle dig was at Jeff Cirillo, who was set to turn 37 at midnight. The way the game was going, it felt like the Brewers and Giants might still be on the field at that hour.

But with the teams tied at 12 in the bottom of the eighth inning, two Milwaukee runs already across and the bases loaded, Cirillo made a game-winning play that won't show up in any box scores. David Bell hit a soft grounder to veteran Giants shortstop Omar Vizquel, who fielded it relatively deep in the hole and threw to second base.

But Cirillo, who reached on the second of two Vinnie Chulk (0-3) walks that followed Bill Hall's game-tying single, hustled to second base and beat the throw. The heads-up play gave Bell an RBI infield single and the Brewers a stunning 13-12 lead.

"I've been in that position as a hitter, where you always want the guy to get there for you," said Cirillo, the Brewers' all-time leading hitter with a .307 average. "More often than not you don't make it, but I don't know what happened on that one. I just read the ball really good."

"He read the ball perfectly," Yost said. "That kind of epitomized our offense all night long. They were going to keep after it, keep doing whatever it took to score some runs."

Brewers reliever Jose Capellan (3-2) got the win and Francisco Cordero notched his 14th National League save.

The Brewers were led offensively by Hall, Kevin Mench and Mike Rivera, who had three hits and three RBIs apiece. Barry Bonds had two doubles, a home run and six RBIs for the Giants, including a go-ahead, three-run homer in the sixth inning.

With his 733rd career home run, Bonds tied Hank Aaron's NL record. Bonds has hit 25 home runs this season, leaving him 22 shy of Aaron's Major League record.

"He's back," Yost said. "He's been very, very hot. We were going to walk Bonds in the sixth, but we ended up walking [Shea] Hillenbrand in front of him and we couldn't put the tying run on second base. You don't want to walk the bases loaded there for [Ray] Durham."

Durham later hit a solo home run in the eighth inning for a 12-10 lead, setting up the Brewers for their final comeback. It capped a wild night.

"Normally games are wild in the first part and they settle down, or they're wild in the middle or in the end," Yost said. "This game was wild from the first inning on, both ways. It was a huge pick-up for our offense to carry the game like they did."

The Giants took a 4-0 lead on Doug Davis and the Brewers in the top of the first inning, only to watch the Brewers answer with five runs in the bottom half against Jonathan Sanchez and extend the lead as wide as 9-4 after the fourth. By the end of the fifth inning, all eight of Milwaukee's positional starters had scored at least one run.

But back came the Giants, scoring three runs off Davis in the fifth inning to knock him out of the game and four more in the sixth against reliever Chris Spurling, including Bonds' go-ahead home run to straightaway center field.

In five innings, Davis was charged with seven runs, six of them earned, on nine hits.

"It wasn't a good night for me," Davis said. "[The hitters] bailed me out quite a bit. They gave me a big lead and I made some bonehead pitches that should have never even crossed my mind to throw. Just bad."

After Cirillo's scamper in the bottom of the eighth, the Giants looked poised for yet another comeback. Pedro Feliz struck out against Cordero leading off the ninth inning but took first base on a wild pitch.

"You figure, 'What else is going to happen on a night like tonight?'" Yost said. "Of course he's going to have to get four outs."

Said Cordero: "You don't worry about the guy getting on first. You've got to worry about him scoring."

Feliz ultimately reached third base but stayed there. Randy Winn grounded out to Hall at shortstop to end the game.

"It's great that at this stage of the season, we're still playing hard," said Rivera, who set a career high with his three hits. "We showed that we're going to finish the season strong."