CHICAGO -- The string of bad weather continued at Wrigley Field. Several other trends show signs of reversing.
"I have a long way to go," Ramirez said. "Hopefully, I keep driving the ball."
Ramirez's line drive solo shot in the second broke a streak of 155 at-bats without a home run, the second longest stretch of his career. Ramirez went 170 at-bats between homers from Aug. 2, 1998, until April 21, 2000.
"He put a great swing on that ball," Cubs manager Mike Quade said. "Those home runs are going to come for him."
Dempster (4-4) recovered from a poor start to post his fifth quality start in his last six outings. After allowing two runs, a walk and Lyle Overbay's two-run double in the first inning, Dempster settled down to shut out the Pirates on four hits over the next five innings.
"The first inning started out great," Dempster said. "There is a lot of game left after that. Just keep going out there and getting outs and making pitches."
Dempster allowed four hits and two runs overall, striking out five and walking three. He beat the Pirates for first time in five starts dating to May 4, 2010.
After a rough April, Dempster is now 3-1 with a 3.08 ERA in his last six outings.
"A few pitches got away from him in that first inning," Quade said. "We've talked a little about him regrouping and getting himself back in tune with command of his pitches. After that first inning, he was able to do that. He's had a great May."
"That's kind the way we left spring training drawing it up," Quade said. "We'll (like) a three-run lead in the ninth, but those are the kind of things you hope you'll be able to do."
The Cubs beat the Pirates for the second time in six games at Wrigley Field this season. Even after Sunday's loss, the Pirates have beaten the Cubs in 16 of the last 23 meetings.
"It seems like they always give us a tough time," Ramirez said. "They've got good pitching, good young players. But we should play better against them."
Pirates starter Jeff Karstens (3-4) allowed three runs -- two earned -- and struck out four over five innings. Karstens, who recently took the rotation spot of injured Ross Ohelendorff, departed after throwing just 71 pitches.
"We take two out of three and I had to be the guy that ended up losing that game," said Karstens. "We had a lot of road woes, but this year we're doing a little bit better."
Overbay walked and drove in both Pittsburgh runs with his two-run double in the first.
The game was delayed by 2 hours, 34 minutes at the start because of heavy rain. However, once the storm front cleared the Chicago area, it was a mild and pleasant afternoon.
The Cubs scored their first run in the second on the long-overdue homer from Ramirez, who has averaged 28 each of his seven full seasons with the Cubs. Carlos Pena, who followed with a single, has reached base in 21 of his last 23 games.
Speedy Cubs rookie Tony Campana then hit a grounder to shortstop Ronny Cedeno and beat the throw, which skipped away from Overbay. Pena advanced to third on the play and Cedeno was charged with an error, snapping his 35-game errorless streak.
Pena scored on Koyie Hill's sacrifice fly to right. Pena beat the throw of Pirates right fielder Garrett Jones, but he slid into catcher Ryan Doumit, who left the game with what the Pirates called an injured left ankle. He was replaced by backup Chris Snyder.
Doumit will undergo an MRI exam in Pittsburgh on Monday.
"(Pena) came in hard and I am sitting there bracing, waiting for the throw and obviously we've seen these things happen in the past," Doumit said. "It's the nature of the beast."
Some familiar Cubs nemises got the Pirates out to an early 2-0 lead.
Andrew McCutchen and Neal Walker drew back-to-back walks against Cubs starter Ryan Dempster. Both scored on Overbay's double into the right-field corner.
McCutchen has now reached base safely in his last 21 games against the Cubs. Walker, who singled in the sixth, has hit safely in all 15 games he's played against Chicago in his career.
"We're not disappointed," Pirates manager Clint Hurdle said. "We went out and played a ballgame and they played better than us. We won the series. That was the objective coming in. We'll move on. We had a chance to sweep, but we didn't sweep. We have to do things to win a game. We scored two in the first and we weren't able to add anything after that."
Catcher Geovany Soto returned to the Cubs' clubhouse after being activated off the DL. He hasn't played since May 10 because of a left groin strain. To make room for Soto, the Cubs optioned backup catcher Welington Castillo to Triple-A Iowa. Soto is expected to start in Monday's series opener against Houston. ... The Cubs placed CF Reed Johnson on the DL because of lower back spasms and recalled OF Brad Snyder from Iowa. The Cubs also had to clear space for Snyder on the team's 40-man roster, so they moved injured starter Andrew Cashner (right rotator cuff strain) to the 60-day disabled list.