Giles rapped a two-run single in the first inning and Ramirez followed with a two-run homer as the Pirates snapped a nine-game road skid against the
with a 5-2 victory.
The triumph also snapped the Astros' five-game winning streak.
(3-4) allowed two runs and five hits in 6 1/3 innings for his first victory since May 31.
"He's been pitching like that all year," Pirates manager
said of Wells. "Kip has been outstanding. You talk about tough luck, he's had it. We have not protected leads for him, not swung the bats for him."
"The guy's good," said Astros second baseman
, who extended his career-high hitting streak to 14 games with a fifth-inning single. "I can't explain why he's not winning more. He throws in the mid-90s."
led off the game with a single off
(5-5) and advanced to third on a single by
, who extended his career-high hitting streak 17 games. But Lofton injured his right hand sliding into third and left the game.
X-rays proved negative and he is listed as day-to-day with a bruised hand.
Giles followed with a single that plated pinch runner
and Kendall before Ramirez staked Wells to a 4-0 cushion with his 10th home run, a blast to left field.
"It was a 3-2 fastball inside," Ramirez said. "I made a pretty good swing on it. I was thinking just put the ball in play.
"That's good when you (get four runs off Oswalt in the first). He's pretty tough. It's pretty comfortable for a starting pitcher to get a four-run lead."
Oswalt, who was making his second start since returning from the disabled list, gave up four runs and eight hits in six innings. It was his first loss since May 9.
"Sometimes you get beat in the first inning and sometimes in the last," Oswalt said. "The big thing is to stay away from the big inning, and the first inning was a big inning."
"After he got past the fourth hitter, he pitched a clear game," Astros manager
said. "Even at four runs we had a chance to get back in it. But their pitcher didn't let us."
Wells got out of a bases-loaded jam in the fifth inning, inducing
to pop out to end the threat.
"That was the defining moment in the game," McClendon said. "I told him, 'Don't lose by not using your best stuff.'"
"(Lloyd) wanted me to go after him," Wells said. "Challenge him on the inside half of the plate. I pitched him in pretty much the whole time. I wanted to get in the dugout as quickly as I could. I got a lot of jam shots, soft fly balls.
had a good game plan for these guys."