ST. LOUIS (AP) -- If Jose Pirela got a boost of confidence from facing a struggling St. Louis bullpen, he wouldn't admit it.
Carlos Asuaje's RBI single in the ninth inning gave San Diego the lead and Pirela's sacrifice fly proved to be the game-winner as the Padres rallied to beat the Cardinals 4-3 on Thursday night.
Asuaje's hit, his third of the game, off Zach Duke scored Jabari Blash. Neither Duke nor Sam Tuivailala (3-2) recorded an out in relief in the ninth for a Cardinals bullpen that surrendered 12 runs in seven innings during the series.
"They have a good `pen; they have some good arms out there," Pirela said through an interpreter. "I think it's really about us going out there and doing our job and staying focused and when there are men on base bringing them in and luckily we were able to do that throughout the series."
Luis Perdomo gave up two runs in six innings, tying Jhoulys Chacin for the Padres team lead with 13 quality starts. Perdomo, who was claimed off the Cardinals farm system by Colorado in the 2015 Rule 5 draft, was lifted for pinch-hitter Allen Cordoba, whom the Padres plucked from the Cardinals' system in the 2016 Rule 5 draft.
"Outside of two hanging sliders that they did damage on, it was as good as he's thrown," Padres manager Andy Green said. "I thought his fastball location was good on both sides of the plate. I'm really pleased with his effort."
Kirby Yates (3-4) pitched the Padres out of an eighth-inning jam and Brad Hand earned his 12th save in 16 attempts as the Padres won their first series at St. Louis since April 2011.
"Stay focused, take every pitch, take every at-bat, take every game like it matters and let the rest take care of itself," Pirela said. "We've been doing that and you're seeing the results."
Matt Szczur's infield single scored Asuaje to give the Padres a 2-1 lead in the sixth. Cardinals starter Carlos Martinez appeared to pitch out of a bases loaded, no-out jam one batter before by enticing Cory Spangenberg to ground back to him, but Martinez's throw home sailed over Yadier Molina's head allowing Manuel Margot to score.
"Unfortunately those are the errors that will cost you a win and I take that fully," Martinez said through an interpreter. "That's on me."
Margot, Asuaje and Pirela combined for seven hits and three walks.
"The top three guys in our order pretty much drove us today," Green said.
Just one of the two runs Martinez gave up through seven was earned. Martinez struck out six, including the side in the fifth on 10 pitches.
"Just one of those games were you make a play or two it looks completely different, but he did a great job of holding it together keeping it there and gave us a chance," Cardinals manager Mike Matheny said. "We just couldn't put more on."
Jedd Gyorko's RBI single gave the Cardinals a 1-0 lead in the fourth. It was Gyorko's 16th RBI in 10 career games against his former team and the ninth consecutive game with an RBI against the Padres.
Randal Grichuk homered in the ninth off Hand.
Grichuk made a diving catch in right field to rob Perdomo of a single in the third.
Kolten Wong saved two runs in the sixth by snagging Luis Torrens' hard grounder up the middle and throwing off balance to first to end the Padres' rally.
TAKE A BOW
Padres bench coach Mark McGwire received a standing ovation from the 38,726 at Busch Stadium while being honored in the middle of the sixth for his upcoming induction into the Cardinals' Hall of Fame on Saturday.
Padres: RHP Chacin had swelling in his pitching hand after getting jammed batting on Wednesday and is day to day.
Cardinals: 1B Matt Carpenter (virus) missed his second straight game.
Padres: LHP Travis Wood (3-4, 5.81 ERA) opens a three-game set at Miami and LHP Adam Conley (6-5, 4.93 ERA). Wood pitched a season-high seven innings in his last start, his longest outing since April 28, 2015.
Cardinals: RHP Michael Wacha (9-6, 4.08 ERA) opens a three-game interleague series against Tampa Bay and RHP Jake Odorizzi (6-7, 4.74 ERA). Wacha has received just one run of support in four of his last five starts.