BALTIMORE -- Trevor Cahill finally pitched a game in which he did not yield a home run, and lost anyway.
David Hernandez gave up two homers, yet managed to earn a redemptive win following two straight unsightly defeats.
Brian Roberts had three hits, an RBI and two stolen bases for the Orioles, who had been outscored 30-6 in their previous four games against Oakland this season. It was Baltimore's first win over the A's since July 22, 2007.
"Both starting pitchers were good, but what counts is that Hernandez was better," Orioles manager Dave Trembley said.
"The one to Hairston was a hanging slider and he hit it out," Hernandez said. "The second one, to Kennedy, I didn't think he would be swinging because the previous batter swung at the first pitch. I thought he would take it, but he was dead red waiting on it."
Still, Hernandez's improvement over his past two starts was profound. After throwing 102 pitches over 4 1/3 innings in a loss to Boston and surrendering five runs in three innings against Detroit, the rookie was solid against the A's.
"I knew I had to redeem myself because I didn't want to have three straight bad starts," he said.
Cahill (6-12) gave up three runs and eight hits in seven innings but lost his fourth straight start. His 12th defeat of the season left him tied for most in the AL.
Cahill had allowed at least one homer in each of his previous nine starts, but he kept the ball in the park to end the third-longest streak in Oakland history.
"I was happy. I was able to go seven. That's what I've been trying to do, is go deep in the game and I was really happy I didn't walk anybody," Cahill said. "That's how I've been struggling this year. I fell behind a couple of times and was still able to get some outs, so I was happy with that."
Oakland manager Bob Geren agreed with Trembley's assessment that Hernandez was just a bit more effective than Cahill.
"The conditions were right for a lot of runs if the pitchers weren't as good as they were. Both pitchers threw well, but their guy, it was showing 94 [mph] on the gun but it seemed like it had like a 96-98 kind of effect," Geren said. "Got to give him a little bit of credit -- we were on some pitches but we didn't square them up."
The Orioles took a 1-0 lead in the second when Nolan Reimold led off with a single, stole second, took third on a groundout and scored when Melvin Mora inadvertently hit an RBI grounder to first after being jammed on a pitch off his fists.
Hairston hit his fourth homer in the fourth inning and Kennedy connected for his 10th in the fifth to put Oakland up 2-1.
Baltimore regained the lead with a two-run fifth. Roberts hit an RBI single and Adam Jones drove in a run with a groundout, but the inning ended when Roberts lost track of the outs and was doubled off second after running home on a one-out popup by Nick Markakis.
After Cahill left, Jay Marshall pitched a perfect inning for the A's in his first major league appearance since 2007.
Rajai Davis hit the 10,000th double in Oakland history in the first inning. Sal Bando had the first, on April 13, 1968. ... The Orioles ended a three-game skid and improved to 7-18 since the All-Star break. ... Roberts improved to 12 for 12 stealing third base. Since the start of the 2003 season, he's 71 for 77 stealing third.