OAKLAND, Calif. -- Trevor Cahill was in trouble for the first time in a month.
Cliff Pennington bailed him out.
"He's very talented, very smart, very even-keeled," Oakland manager Bob Geren said of his All-Star pitcher. "He doesn't let things bother him and it works to his advantage. It's a real perfect pitcher's mentality."
Cahill (13-5) allowed just one earned run in his previous 33 innings, gave up a pair of home runs and was on the hook for the loss until Pennington's two-out hit off reliever Dan Wheeler gave the A's their third straight win following a four-game losing streak.
The right-hander entered the game on a roll, carrying a 0.27 ERA over his last five starts. He settled down after Evan Longoria's solo homer in the sixth and retired seven of the final eight batters he faced.
"I'm just trying to throw strikes and keep the walks down," Cahill said. "It helps when we have defense like we had tonight. Baseball's kind of a streaky game and I'm just on the positive side of a streak right now. I can't really attribute it to anything."
Jerry Blevins pitched the ninth for his first career save.
Pennington also had a winning single in the bottom of the ninth of Wednesday's 5-4 win over Toronto.
"Getting two-out hits is what this team has to do to win ballgames," Pennington said. "When we get a big two-out hit it's just huge whoever it is."
Tampa Bay had been cruising until then with a 3-1 lead.
"I felt real good about Danny in that spot on what was coming up right there," Rays manager Joe Maddon said. "He's not normally one to walk somebody in that moment and it just happened. I liked him on Pennington, too. It just didn't work."
Just as critical was Oakland's defense.
The A's turned two double plays behind Cahill and got the big catch from Crisp, who made a leaping grab at the wall to steal a home run from Joyce after the Rays had taken a 3-1 lead.
"That was such a big play when you look at it now," Geren said. "You never know on defense when you can make a play that can win a game for you but looking back, that was one that really changed the outcome."
Carlos Pena also homered for the Rays, who snapped a five-game winning streak and fell one game behind the Yankees in the AL East.
It was the third straight win for Oakland after being held to one hit by Toronto's Shaun Marcum on Monday. The A's also made it back to .500 for the 21st time this season, two shy of the franchise most set in 1947 by the Philadelphia A's.
It wasn't easy.
Tampa Bay starter Andy Sonnanstine stymied Oakland's offense for five innings despite pitching with runners on base in every inning but one, while his teammates muscled up in a rare show of power against Cahill.
Cahill had not allowed a home run since July 17 before giving up a two-run shot to Pena in the fourth and a solo shot to Longoria in the sixth.
Sonnanstine scattered five hits over 5 1/3 innings in just his third start of the season. The right-hander, who began the season in the Rays' bullpen, walked three and struck out three before leaving with two runners on and out in the sixth.
Wheeler (2-1) relieved Sonnanstine and walked Kevin Kouzmanoff to load the bases then gave up an RBI grounder to Rajai Davis that made it 3-2. Pennington followed with a line drive double down the right field line to give the A's the lead.
Pena, who had missed 14 games on the disabled list until being activated Monday, went just 2 for 14 in the Rays' three-game sweep of Texas before collecting a pair of hits off Cahill, including his team-leading 24th homer.
Longoria's homer with one out in the sixth made it 3-1. Joyce nearly added to the Rays lead two batters later until Crisp jumped at the wall and caught the ball to rob Joyce of a home run.
A's closer Andrew Bailey will pitch one inning for Triple-A Sacramento on Friday, the latest step in his recovery from a rib cage strain. ... Tampa Bay's Carl Crawford had a nine-game hitting streak snapped. ... Pena, who broke into the majors with Oakland in 2002, has hit 13 career home runs at the Oakland Coliseum.