SAN FRANCISCO -- Having hit only three home runs all season and none against left-handed pitchers, Clint Barmes wasn't trying to be a hero on Friday night.
He was just trying to get his pitcher, Charlie Morton, off the hook.
Focusing on driving in the tying run in the seventh inning with as little as a ground ball, Barmes instead turned on a Madison Bumgarner down-and-in slider and smacked a three-run homer, delivering the Pittsburgh Pirates a 3-1 victory over the San Francisco Giants.
Barmes, the No. 8 hitter in the lineup, came to the plate with one out and runners on second and third, his team trailing 1-0.
"My mindset at that time was get at least one of them in," the .224 hitter said. "It was a pretty good pitch. I dropped the barrel on it and hit it well."
The quick score reversal flipped Morton (5-3) from potential loser to winner. The second-year right-hander limited the Giants to one run and seven hits in 7 2/3 innings as Pittsburgh, for the second night in a row, won to retain a one-game lead in the National League Central over the St. Louis Cardinals.
"Charlie was throwing the ball well," Barmes said. "To get the opportunity in a one-run game ... you always want to come through for your pitcher."
Before the game, the Giants placed Thursday's starting pitcher, Matt Cain, on the disabled list, ending the veteran's 261-game run of never having been on the DL. Cain was hit on the right forearm by a line drive off the bat of the Pirates' Gaby Sanchez in the fourth inning of Thursday's 10-5 Giants loss.
Bumgarner (11-8), who replaced Cain as the ace of the San Francisco staff this season, had blanked the Pirates on four hits through six innings before Sanchez and Josh Harrison singled on back-to-back pitches leading off the seventh.
Neil Walker's second sacrifice bunt of the game advanced the runners into scoring position, and Giants manager Bruce Bochy elected to pitch to Barmes while the Pirates scurried to get relief pitchers warmed up and send a potential pinch-hitter for Morton into the on-deck circle.
Barmes, who had not homered off a left-handed pitcher since July 26, 2012, stunned Bumgarner with his shot into the left-field bleachers. It was only the fourth time that Bumgarner has allowed a home run with more than one runner on base in his career.
"It was right where I wanted it," the All-Star left-hander said of his 1-1 pitch. "In those situations, I just try to minimize the damage. It didn't happen that time."
Making his third career start against the Pirates, Bumgarner had limited the emerging NL Central power to one run in his first 19 innings.
After Barmes' homer, Pirates manager Clint Hurdle recalled Tony Sanchez, his prospective pinch-hitter, from the on-deck circle and sent Morton back to the plate. It allowed the right-hander to pitch an additional 1 2/3 innings.
"I'm really happy for him," Morton said of Barmes. "That was great."
Left-hander Tony Watson relieved Morton with two outs in the eighth and the potential tying run, Brandon Belt, at the plate. Watson struck out the Giants' hottest hitter, stranding Brandon Crawford on second base.
Mark Melancon, serving as the Pirates' closer in the absence of injured Jason Grilli, pitched the ninth for his ninth save despite giving up a one-out single to Hunter Pence, his second hit of the game.
"The one thing we've been good at is being a good team," Hurdle said. "We've had different guys show up at different times all season."
The win was Morton's first after successive no-decisions in which he had allowed a total of four runs. He struck out three and walked just one.
Morton, now 4-1 since the All-Star break, threw only 83 pitches, getting 11 ground balls in the 29 batters he faced.
"That's the game plan -- getting the ball on the ground," he said. "My sinker is that good. The defense was making great plays."
In assuring a winning seven-game western swing by posting a fourth victory in five games, the Pirates secured their 34th road win of the season, matching last year's total. They also clinched a season-series win over the Giants with a 4-1 record. Just two matchups between the teams remain this weekend.
The Giants lost for the fourth time in five games on their current homestand. They've been outscored 34-10 in the five games.
Bumgarner lost his fourth consecutive start. He allowed three runs and seven hits in eight innings, walking four and striking out five.
NOTES: Cain's 261-game streak to start his career without a DL stint was the sixth longest among active pitchers. Cain had missed only one scheduled start -- when he was skipped over in the rotation -- in his nine years in the majors ... Barmes' homer was the Pirates 15th in the last 12 games. ... Pirates CF Andrew McCutchen, who had been hitless in his career against Bumgarner, had two of Pittsburgh's seven hits. ... The Giants recalled RHP Yusmeiro Petit and LHP Mike Kickham from Triple-A Fresno before the game. Both are candidates to make Cain's scheduled start on Tuesday at Colorado. ... Giants INF Nick Noonan was demoted to Fresno to create a roster spot for Kickham. ... Pirates OF Travis Snider advanced from Double-A Altoona to Triple-A Indianapolis in his injury-rehab assignment on Thursday. Snider has been on the DL since July 28 with a sore left big toe.