The 5-2 loss, which put their five-game winning streak to bed, was charged to righty Dan Otero, marking the first in his career in his 66th appearance.
Looking to extend a stretch of 16 2/3 scoreless innings, Otero gave up three hits in the 11th, including a two-out RBI single to Desmond Jennings on a 3-2 pitch to allow the Rays to tie the game, 2-2.
It was over within minutes, as Luke Gregerson quickly offered up a walk-off three-run homer to Sean Rodriguez.
"We were trying to front-door him, and it just got out over the zone," said catcher Derek Norris, "and he did what a big league hitter is supposed to do with it.
"We definitely felt like we should've came away with three [wins], but that's the way it bounces. We'll dwell on this for about five minutes, get in the shower and bounce back in Toronto."
Toronto is where the A's will end this nine-game, three-city road trip. They're 5-1 after swings through Cleveland and St. Petersburg, and despite Thursday's tough loss, still a Major League-best 30-17 with a 3 1/2-game lead over the idle Angels in the AL West.
"It's always nice to win a series, but when you've won two and you're ahead going into the last one, not being able to close it out is a bit disappointing," said manager Bob Melvin, "but we move on."
Otero, who had already given the club 1 2/3 scoreless innings leading up to the 11th, was one pitch away from closing it out.
"Any time your team battles like that and gives you the lead and can't check out, it's tough, whether you're one pitch away or nine," Otero said. "I went out there to get three outs and unfortunately left a couple balls up and they scored some runs."
"We needed some kind of boost all night," said Rays manager Joe Maddon, his club now 20-28. "We were foiled in our attempts, and you've got to give Oakland credit. They're playing at a very high level right now. I see both teams as being very, very equal. Hopefully we get another chance at them. We will in the regular season, and hopefully beyond that, because I have a lot of respect for them."
It was the A's who trailed, 1-0, after the first eight innings, despite an excellent performance from Gray, before getting a game-tying double in the ninth off former teammate Grant Balfour from Yoenis Cespedes, who put the team ahead in the 11th with a sacrifice fly.
While Gray gave the A's eight innings of one-run ball with only five hits and two walks allowed, Tampa Bays' Alex Cobb got up to 96 pitches in 6 2/3 scoreless innings in his first start off the disabled list, limiting Oakland to just three hits and two walks while fanning six.
Gray struck out only three, letting his defense do the work -- notably an infield that fielded his 14 groundball outs -- while lowering his ERA to an AL-best 1.99. He also got a tremendous catch from Josh Reddick in the third inning, when the right fielder robbed Wil Myers of what was likely going to be a three-run double if not for his web-gem grab at the wall.
"Unbelievable," said Gray, who is the first A's pitcher since at least 1913 to begin the season with 10 consecutive quality starts.
The righty matched Cobb zero for zero through the first six innings, before walking James Loney to lead off the seventh in advance of consecutive one-out singles from Cole Figueroa and Yunel Escobar that led to a run and gave the Rays their first lead in six days.
"Cobb's a great pitcher. He's actually one of my favorite ones to watch," said Gray. "You could tell from the first inning he had his stuff and was going to be pretty tough. I really had all of my pitches working. My sinker was good, my four-seam was good, and I was able to throw my curveball when I needed to. Other than the one I hung and kind of left on the inside part of the plate to Escobar, I thought everything was working pretty well today."
"It felt like, for a while, there might not be any runs scored," said Melvin, "because you've gotta wait out the starting pitcher and try to get to the bullpen."
The A's did, only to strand the bases loaded in the ninth and ultimately drop just their third extra-inning game in eight tries this year.
"That was a battle," said Reddick. "Cobb's always been great, especially against us. Once we got him out of the game, I felt we had a good chance of taking advantage of it. There's just no way that game should go extra innings with the ninth inning we had."