Oakland scored three runs in the final three innings to fuel the win, which tied the three-game series.
It also marked the second time on the year that Gomes hit a homer off Peralta. The other came in the 12th inning of a May 5 meeting.
"I've always had a lot of respect for Jon Gomes, I've talked about that for years," Maddon said. "He's a good baseball player. The guy cares and he beat us tonight. He beat us against a guy with an equally big heart in Joel Peralta. They're gamers and Jon came out on top tonight, but I'll always put my money on Joel Peralta"
Tampa Bay starter Matt Moore turned in another solid start, allowing three runs in 6 1/3 innings on seven hits and a walk with seven strikeouts.
"It was a little more of fastball and breaking ball today," Moore said. "They're a good hitting team. They have some guys that can turn the ball around and some guys that can go with it."
Jarrod Parker, who pitched opposite of Moore, turned in a nearly identical game, giving up three runs on seven hits over seven innings with two walks and seven strikeouts.
The A's bullpen would notch five more punchouts on the night to bring the team's total to 12. Carlos Pena fared the worst at the plate against Oakland, going down on strikes three times, including once in the eighth. Four other Rays struck out at least twice.
"I know who's hot and who's not, and obviously they're one of those teams that rides the wave," Parker said. "Any time you can kind of keep them quiet and from running wild and doing the things they do well is a plus in my mind. I think we're pretty hot too, and when we're able to come into this game and battle and go blow for blow, it's fun."
The first pitch in the bottom of the second was blasted over the right-field wall, courtesy of Ben Zobrist to start the game's scoring. The homer was his 15th of the year and gave the Rays the early 1-0 lead.
Yoenis Cespedes hit a one-out triple in the top of the fourth and Chris Carter followed that up with a walk to give Oakland some momentum against Moore. Gomes struck out, but Josh Donaldson came through with an RBI single that evened the score.
Derek Norris was then hit by a pitch before Brandon Moss hit a sharp grounder to first. Carlos Pena fielded the ball, but Moss was able to get to the bag and beat out Pena's toss to Moore, allowing Carter to score. The inning ended when Donaldson got caught in a rundown between third and home plate.
The A's lead didn't last long, though, as the Rays responded in the bottom of the frame. Zobrist cranked a triple to right field and Jeff Keppinger brought him in with a sacrifice fly, evening the game at 2.
Tampa Bay took the lead again in the fifth when Jose Molina hit a double and two batters later, B.J. Upton hit another, making it a 3-2 ballgame.
The Rays seemed to miss an opportunity an inning later when a single by Ryan Roberts could have possibly scored Evan Longoria from second base. Due to a "miscommunication" between Longoria and third-base coach Tom Foley, Longoria, who has baserunning restrictions because of a partially torn hamstring, thought he was told to stop.
"I think what [Foley] was trying to do was to not have [Longoria] run too hard as to not hurt himself," Maddon said about the play. "I think it was misunderstood on Longo's side to not go."
Oakland tied it up in the top of the seventh, thanks to back-to-back doubles from Donaldson and Norris before Gomes blasted a two-run homer in the top of the eighth to get the win.
"That's my third at-bat off him this year, so it worked to my benefit, having a little scouting report on him," Gomes said of the homer. "That's a good team over there, and he's their eighth-inning guy. But that's how close games are won, a bloop and a blast. I don't get that without the bloop. You're trying to be aggressive early."