SAN FRANCISCO (AP) -- With his team slumping and his offense struggling, all Giants manager Bruce Bochy could do was take responsibility and shake his head for a lineup mistake that wiped away a run and a rare lead.
''At that point, I just said, 'What else?''' Bochy recalled.
The day turned out just fine for Bochy, with Madison Bumgarner driving in two runs and striking out nine in seven innings to lead the Giants to a 4-2 victory over the Los Angeles Dodgers on Saturday.
San Francisco was caught batting out of order in the first inning, taking away Buster Posey's RBI double. Bochy submitted a lineup with Posey batting fourth, but the reigning NL MVP and batting champion hit third.
Bochy called the mistake a ''perfect storm'' of events.
As the defending World Series champion manager, Bochy had been finishing rosters all day for the NL All-Star team announcement. It also was only the second day the Giants used a digital lineup in the clubhouse, which showed Posey batting third, where the All-Star catcher had batted in 15 straight games until Friday.
Papers passed out in the press box and the scoreboard in center field listed Posey third as well - just not on the official lineup card submitted to the Dodgers and umpires. Bochy said he filled out the card and gave it to bench coach Ron Wotus, declining to name the Giants official who entered the lineup into the electronic system.
''The buck stops here,'' Bochy said, assuming all the blame.
''You feel horrible,'' he said. ''There's not a worse feeling. At that point, you're going, 'Geez, what's going on?' We've had a lot of things happen, and now that. That was a huge game for us. I would've felt horrible if that would've played a part in us not winning.''
Thankfully for the Giants, it didn't.
On the day he earned his first All-Star selection, Bumgarner bailed out the man who made the choice. The big lefty retired his first 14 batters, allowing Tim Federowicz's two-run homer in the fifth inning for Los Angeles' only runs.
Bumgarner (9-5) said Bochy had informed him Friday to take the pressure off his start. The pitcher only told his wife until the official announcement.
''That was tough to walk around and not tell anybody,'' he said.
Gregor Blanco had three hits and an RBI to end an 0-for-25 skid, and first-time All-Star Marco Scutaro drove in another run to help San Francisco stop a four-game losing streak.
Sergio Romo pitched a perfect ninth for his 20th save.
Stephen Fife (3-3) allowed seven hits and four runs - although only one was earned - in 4 1-3 innings. The Dodgers committed three errors and never got going offensively, with rookie sensation Yasiel Puig striking out four times for the first time this season.
Help is on the way for the Dodgers. They acquired right-hander Ricky Nolasco from the Miami Marlins during the game in exchange for three minor league pitchers.
But they couldn't find a way to match Bumgarner, who gave up three hits and walked none. He has won five of his last six starts.
It was only the fourth time in 15 games the Giants had scored more than two runs. San Francisco also had lost 10 of its last 11 games and started off looking even worse.
After Posey hit third in Pablo Sandoval's spot to give the Giants a 1-0 lead, Dodgers manager Don Mattingly called out the mistake to umpires. Posey was ruled out but got to bat again in the fourth spot, ending the inning on a flyout to right field.
Mattingly said bench coach Trey Hillman pointed out Posey's mistake as soon as he was announced at the plate.
''It's one of those things. It can happen easily when you make lineups day to day with the computer programs,'' Mattingly said.
Posey said he looked at the digital lineup in the clubhouse. ''I was batting third and I looked at the lineup on the scoreboard and I was batting third. Somewhere, something got crossed up,'' he said.
Bochy even talked before the game about wanting to return Posey permanently to the fourth spot with Sandoval healthy again and San Francisco struggling.
''In the middle of the at-bat I was looking at it like I was losing it,'' Bochy said.
The move might have been a bit of redemption for Mattingly, though the Giants were able to laugh it off in a win.
After separate ejections of manager Joe Torre and bench coach Bob Schaefer in the Dodgers' 7-5 loss to San Francisco on July 20, 2010, Mattingly made his own mistake while he was the hitting coach. He went to the mound for a chat with closer Jonathan Broxton in the ninth inning before Andres Torres came up. Mattingly took a few steps back off the dirt toward the dugout before turning around and advising first baseman James Loney exactly where he wanted him positioned.
Bochy came out to protest to plate umpire Adrian Johnson that Mattingly's about-face constituted a second trip to the mound. The umpires huddled and agreed, and Broxton had to leave the game. Mattingly was forced to summon George Sherrill, who promptly served up Torres' two-run double that gave the Giants the lead.
Los Angeles made more than its share of mistakes on Saturday.
In the second inning, Nick Punto's throw pulled shortstop Hanley Ramirez off second base for an error. Bumgarner walked to force in a run, Blanco's single drove in another and Scutaro flied out to right to put the Giants ahead 3-0.
Torres also reached in the fourth when Ramirez misplayed his grounder and was slow to recover, setting up Bumgarner's sacrifice fly that stretched San Francisco's lead to 4-0.
Andre Ethier's bloop single to left with two outs in the fifth was the first baserunner off Bumgarner. Federowicz followed with his third home run to trim the Dodgers' deficit to 4-2.
Ramirez tripled leading off the seventh before getting thrown out at the plate after Sandoval fielded a grounder at third.
NOTES: Mattingly said he's hopeful CF Matt Kemp (irritated left shoulder) will play Sunday or Monday at the latest. ... A moment of silence was held before the game for victims of an Asiana Airlines flight from South Korea that crashed while landing at San Francisco International Airport. ... Dodgers ace Clayton Kershaw (7-5, 1.93 ERA) starts against San Francisco's Chad Gaudin (2-1, 2.60 ERA) in the series finale Sunday.