Jonathan Lucroy's first game-ending hit in his career at any level went all of about 25 feet.
"I've had go-ahead hits in the eighth and stuff, but I've never had a walkoff, winning hit like that," Lucroy said. "Never in college, nothing. I'm glad it worked out for us today."
Lucroy's well-executed bunt was out of the reach of pitcher Guillermo Mota. Braun easily scored and Lucroy began pumping his fists halfway down the line.
"I'm not that good a bunter," the second-year catcher said. "I saw him kind of give up on it, and I just started yelling and screaming. I hit first base, then I started getting punched in the kidneys by somebody. It was a fun time."
Milwaukee is 7-1 on this homestand and 20-7 overall at Miller Park this season, the best home mark in the NL. The Brewers have won 14 of 18, and in different ways — none weirder than this one.
"It says a lot about our team, how we face adversity," Lucroy said. "We just do anything we can to win. We can hit home runs to beat you. Today, I got the squeeze that way. We find different ways to beat people. With the way our team's pitching, I think we can give anybody a run for their money."
Braun and Prince Fielder opened with consecutive singles off Mota (2-2) in the ninth. Casey McGehee's groundout moved them to scoring position and Lucroy came up after Yuniesky Betancourt was intentionally walked.
"I've never been part of a squeeze walkoff. That was awesome," Fielder said. "It's just real exciting, if he misses the bunt, everything is messed up. But Lucroy, he got it down. That was awesome. That's a lot of pressure."
Carlos Gomez hit an inside-the-park home run and McGehee added a sacrifice to make it 2-0 early, but the Giants rallied with two runs in part because of a McGehee error in the eighth.
John Axford (1-1) pitched the ninth, working around a two-out single by Emmanuel Burriss.
Milwaukee squandered Randy Wolf's impressive outing after an error led to two runs in the eighth for the Giants. Wolf didn't allow a hit until the fifth and pitched into the eighth, leaving two on and one out for reliever Kameron Loe
"They battled," Giants manager Bruce Bochy said. "Down two runs, and they found a way to tie and had a good opportunity."
In the bottom of the inning, the game was delayed 12 minutes after home plate umpire Mark Wegner tore the calf muscle in his right leg and needed to be helped off the field.
Gomez made it 1-0 in the bottom of the first after a sharp grounder to right.
Right fielder Cody Ross had taken a poor angle to the ball and it rolled under his glove to the wall while Gomez sped around third and easily home for his third homer this year.
The right-field corner of Miller Park is obscured from view and there were no conclusive TV replays of why Ross couldn't quickly get the ball back to the infield, where he also missed a cutoff throw.
"It should not be an inside-the-park home run," Ross said. "What happened was I went down to go get it and I whiffed, and it got by me. Error. That's it."
It was Milwaukee's first inside-the-park home run since Rickie Weeks' effort on Aug. 7, 2010, against the Astros and 23rd in franchise history.
Jonathan Sanchez, who has struggled with walks all season, had one to Braun cost him in the fourth.
Braun stole second and reached third when catcher Eli Whiteside's throw hopped past Burriss, the shortstop. After Sanchez walked Fielder, McGehee's sacrifice fly made it 2-0.
It'd stay that way until San Francisco's late rally, but Milwaukee found a way to win again with another aggressive play.
"I like games like that," Brewers manager Ron Roenicke said. "Hopefully we're in a position where we can do that a few times."
NOTES: Adrian Johnson will replace Wegner on the crew on Sunday. ... Giants 2B Freddy Sanchez is one hit away from 1,000. ... The Giants activated RHP Santiago Casilla (inflamed elbow) and optioned LHP Dan Runzler to Triple-A Fresno. ... Brewers LHP Zach Braddock (sleep disorder) will pitch in a rehab assignment for three days at Triple-A Nashville beginning Monday. ... Brewers RF Corey Hart was out of the starting lineup after being ill following Friday night's game. ... Giants LF Burrell struck out in the first, then slammed his bat so hard into the ground it shattered. ... With 42,512 in attendance, it was Miller Park's sixth sellout this season.