Pittsburgh Pirates pitcher Ryan Vogelsong works against the San Francisco Giants in the first inning of a baseball game, Monday, Aug. 15, 2016, in San Francisco. (Ben Margot/AP)
SAN FRANCISCO -- From the rousing standing ovation he received in the first inning to the one he got after giving up a pair of home runs in the sixth, Pirates right-hander Ryan Vogelsong had a tough time staying focused in his return to AT&T Park.
After spending parts of seven seasons in San Francisco and helping the Giants win two World Series titles, the normally stoic Vogelsong couldn't help but get caught up in the emotions of the moment.
His Pittsburgh teammates helped make the night even more memorable.
Gregory Polanco had a homer and four RBI, and Vogelsong and the Pirates beat the Giants 8-5 on Monday night.
"I'm really tired mentally," Vogelsong said. "I wouldn't expect anything less from these fans. They're first class and they always have been."
Andrew McCutchen added two hits, two RBI and made a spectacular diving , backhanded catch in the eighth to help Pittsburgh move within one game of idle St. Louis for the second NL wild card.
That was enough for Vogelsong (2-2) to win despite an up-and-down outing.
Vogelsong allowed four runs over 5 2/3 innings, walking three and striking out one before leaving to his second standing ovation of the night.
"I don't think it was just another day at the park," Pirates manager Clint Hurdle said. "I don't think you can prep for things like this. He was so amped up he didn't really want me to come out and take the ball from him."
Fans stood and cheered when Vogelsong, an All-Star with San Francisco in 2011, took the mound in the first, and a video montage of his time with the Giants played on the scoreboard while he warmed.
When he left after allowing Denard Span's home run in the sixth, Vogelsong paused en route to the dugout and tipped his cap to the crowd.
"There are moments in these games that you want to hold on to and remember for the rest of your life. Tonight was one of those for me," Vogelsong said. "It was amazing."
Span had three hits, including a home run, and Eduardo Nunez also homered for the Giants.
Polanco hit a two-run double off starter Matt Moore (0-2) in the fourth, then drove in two more runs with his 17th home run of the season in the sixth.
Francisco Cervelli singled, walked twice and made a sparkling defensive play to tag out a runner at home to help Vogelsong win for the first time since coming off the 60-day DL after being hit in the face with a pitch on May 23.
Tony Watson, the fourth Pirates reliever, retired three batters for his sixth save.
Vogelsong walked Joe Panik with the bases loaded in the first inning, then gave up an RBI single to Hunter Pence in the third.
San Francisco missed a chance to add on when Pence overran third base on Nunez's double and was thrown out while scrambling back to the bag.
"We had some chances," Giants manager Bruce Bochy said. "We just couldn't finish up with men on base."
Left fielder Starling Marte saved a run in the second when he threw out Trevor Brown trying to score from second base on Span's single. Marte's throw was slightly up the third-base line, but Cervelli made a stellar sweeping tag for the out.
DOWN ... AND OUT
Pence made a spectacular defensive play when he caught Josh Harrison's foul ball while on his back after stumbling on the mound in the visiting team's bullpen.
Pirates: Marte was back in the lineup after sitting Sunday with a sore upper back.
Giants: Buster Posey sat for the second straight game due to tightness in his lower back.
Pirates: Jameson Taillon (3-2) faces the Giants for the first time in his career Tuesday night. The right-hander has allowed one earned run over his last 14 innings.
Giants: RHP Jeff Samardzija (10-8) makes his second start against Pittsburgh this season. The Pirates knocked Samardzija out of the game after three innings on June 22.