Kyle Lohse and the St. Louis Cardinals would normally look forward to facing San Diego.

But after the Padres manhandled the playoff-hopeful Cardinals, the defending World Series champs couldn't wait to get out of town.

Clayton Richard pitched seven strong innings and rookie Yasmani Grandal singled home the go-ahead run to lift San Diego over St. Louis 3-2 on Wednesday, handing the slumping Cardinals their 11th loss in 15 games.

The Cardinals remained a game ahead of the Dodgers for the second NL wild card after Los Angeles lost 3-2 at Arizona later Wednesday. The Dodgers host St. Louis in a crucial four-game series starting Thursday night.

San Diego (69-75) has an NL-best 17-5 record since Aug. 19 to creep within 6½ games of the Cardinals with five teams in between.

"It's a long season and you don't know what's going to happen," Grandal said. "Right now we're 6½ games back in the wild card. Baseball is a crazy sport."

Logan Forsythe hit a solo home run for the Padres, who completed a three-game sweep of St. Louis for the first time since August 1995. The Padres have won 21 of their last 27 at home.

"I take it personally as a compliment to our players that we're able to do that," San Diego manager Bud Black said.

The Cardinals own a commanding 262-181 lead in the overall series with the Padres, including a winning record in San Diego. But for this three-game set, St. Louis had no answers.

"We can't depend on the other teams to keep losing," Lohse said. "We have to take care of our own business. We have a big series coming up."

St. Louis put a runner on third with one out in the ninth but was unable to score. World Series MVP David Freese and pinch-hitter Skip Schumaker both grounded out.

Richard (13-12) outpitched Lohse and gave up only three hits, including a two-run homer by Matt Carpenter that tied the game at 2 in the sixth. The left-hander struck out five, walked one and hit a batter with a pitch.

Luke Gregerson pitched the ninth for his seventh save, working around a leadoff double by Allen Craig. After pinch-runner Adron Chambers was sacrificed to third, Gregerson got Freese on a grounder to third before walking pinch-hitter Carlos Beltran. Gregerson then retired Schumaker on an easy grounder to first base to end the game.

Lohse (14-3) had his eight-game winning streak snapped as he allowed three runs — two earned — on five hits over six innings. He struck out eight.

"He was sharp right from the beginning," Cardinals manager Mike Matheny said. "These are the ones we have to take advantage of."

Lohse's streak spanned 13 starts back to June 26.

Forsythe connected with two outs in the second to give San Diego a 1-0 lead. In his last 13 games, he has 11 RBIs and 11 runs while raising his batting average 29 points to .289.

Carpenter's error in right field cost the Cardinals a run in the fifth. Yonder Alonso singled and went to third on Cameron Maybin's one-out double into the right-field corner. But when Carpenter overran the ball, Alonso was able to score.

"I was trying to be aggressive and trying to get around where I could keep him from getting a double," Carpenter said. "The ball just got past me and I turned one bad play into another one by missing the cutoff."

"It's unacceptable," he added. "Those are the kind of things that cost you games. It just wasn't a good play."

Carpenter homered immediately after Jon Jay's leadoff single in the sixth, but San Diego went ahead in the bottom half on Chase Headley's two-out double and Grandal's run-scoring single.

NOTES: It was San Diego's fifth sweep this season. ... Beltran is in a 3-for-26 slump with one extra-base hit in his last 61 at-bats. ... Padres LF Carlos Quentin, who left Monday night's game with a sore right knee, was held out of the lineup for the second straight game. ... Matheny said LHP Jaime Garcia is still set to pitch Saturday night at Dodger Stadium despite a 2-6 record with an ERA of 6.19 in nine road starts. ... St. Louis opens a four-game series at Los Angeles on Thursday night with RHP Lance Lynn (14-7, 4.04 ERA) facing Dodgers RHP Josh Beckett (1-2, 3.86). ... San Diego is off Thursday before hosting Colorado for three games, starting Friday night with Rockies RHP Tyler Chatwood (4-4, 5.32) opposing Padres RHP Andrew Cashner (3-3, 3.46).