SAN FRANCISCO -- San Francisco Giants manager Bruce Bochy arrived at AT&T Park on Monday night prepared to make Hunter Pence his leadoff hitter.
Instead, he wound up batting Pence third in a new-look batting order that featured Marco Scutaro leading off.
The original plan came into play in the eighth inning. Pence, leading off, walked and eventually scored the tiebreaking run in the Giants' 4-2 victory over the Milwaukee Brewers.
Jeff Francoeur's pinch single broke a 1-1 tie and triggered a three-run, eighth-inning rally.
San Francisco had lost seven of its previous eight home games. The defending World Series champs, now 50-61, became just the 11th team in the National League to reach the 50-win milestone this season.
"I want to win. I don't care where I hit," said Pence, who had been slotted fifth or sixth most of the season. "I just want to help."
That's exactly what he did by opening the difference-making uprising with his third walk off the night, this one off John Axford (5-5). The Brewers reliever faced only three Giants and walked two of them, one intentionally.
After Pence stole his second base of the night, the Brewers elected to walk Pablo Sandoval intentionally and bring in left-hander Michael Gonzalez to face left-handed-hitting Brandon Belt. The Giants first baseman drew a walk to load the bases and set the stage for Francoeur.
Brewers right-hander Rob Wooten was brought on to face Francoeur, but he fell behind 2-0 before serving up the tiebreaking hit, a broken-bat flare over shortstop Jean Segura's head.
"Good pitch," lamanted Brewers manager Ron Roenicke, who blamed other factors for the defeat. "We had opportunities and didn't come through. We didn't play well."
The Brewers' biggest mistake came with two outs and the bases loaded later in the Giants' eighth. Pinch hitter Joaquin Arias hit a groundball through Brewers third baseman Jeff Bianchi for a two-run error that broke the game open.
"It's great to have it go your way," Giants starting pitcher Chad Gaudin said. "In a lot of tight games, we've hit balls right at guys. Tonight it went our way."
Santiago Casilla (5-2), the third Giants pitcher, got the win after pitching a scoreless eighth inning. Sergio Romo recorded his 27th save despite serving up Juan Francisco's 15th home run, a one-out solo shot in the ninth.
The win was the first of the season for the Giants over the Brewers, who swept a three-game series against San Francisco in April.
Bochy hoped to shake things up by reworking his batting order. He considered giving Scutaro a day off following a week-long road trip, which would have put Pence in the leadoff spot.
However, when the veteran second baseman gave his manager a thumbs-up, Pence took his good eye and sneaky speed to the third spot in the lineup.
"The thing about getting a walk," said Pence, who'd had just four previous three-walk nights in his career, "you don't go up there looking for it. It just happens."
The Brewers, who were opening a 10-day, nine-game road trip, tied the game at 1-1 in the seventh inning on a ground-rule double by Francisco that scored Jonathan Lucroy, who opened the inning with a double.
Left-hander Javier Lopez relieved Gaudin later in the inning with the bases loaded and one out, and he got pinch hitter Rickie Weeks to ground into an inning-ending double play.
Roenicke argued the close call at first base.
"There were a couple of missed calls that hurt us," he said.
Neither starting pitcher factored in the decision.
Gaudin allowed one run or none for the sixth time in his past seven starts. He gave up four hits, one run and four walks in 6 1/3 innings, striking out eight.
Brewers starter Tyler Thornburg, who was 0-9 at Triple-A Nashville this season, continued his improbable major league success story by holding the Giants to one run, which was unearned, in six innings. The 24-year-old right-hander has not allowed an earned run in either start for Milwaukee this season, and he lowered his overall ERA in eight appearances to 1.78.
NOTES: The Giants are now 4-0 in Gaudin starts that have followed a loss. ... Pence's steals were his 16th and 17th of the season. He has yet to be caught. ... Pence has reached base safely in all 17 Giants games since the All-Star break. ... Giants third base coach Tim Flannery joined his brother, Tom, and guitarist Bob Weir to sing the national anthem on Grateful Dead Tribute Night. Former NBA star and longtime Grateful Dead supporter Bill Walton threw a ceremonial first pitch. ... The Giants announced before the game RHP Ryan Vogelsong would return from the disabled list to start Friday's series opener against the Baltimore Orioles. Vogelsong hasn't pitched in the majors since breaking bones in and below his right pinkie finger while batting May 20. ... Injured 3B Aramis Ramirez made the road trip with the Brewers and is expected to be activated from the DL in time to serve as the club's designated hitter in Seattle and Texas. ... Brewers minor league LHP William West, 20, was suspended for 50 games for a second violation of baseball's minor league drug policy. The violation was not connected with the Biogenesis investigation. West had been pitching in the rookie-level Arizona League.