That one swing was all it took for Oakland to escape with a win, though.
Gomes' grand slam helped the A's overcome a career-high 15 strikeouts from Liriano and beat the Minnesota Twins 6-3.
Liriano's 15 strikeouts were the second most in Twins history and most since Johan Santana fanned 17 Texas batters at the Metrodome on Aug. 19, 2007.
"You got to swing," said Gomes, who hit the slam on the first pitch of his second at-bat after whiffing on three straight in his first plate appearance. "You just hope it's a strike, not like the first three pitches I swung at. You have to be aggressive, often."
It was the 23rd time since 1961 that a pitcher had 15 or more strikeouts and lost the game.
Josh Willingham hit two home runs for Minnesota, which has lost five of six.
A.J. Griffin (1-0) battled through six innings to earn his first career win and lead the A's to their seventh victory in eight games.
"It might not have been my best outing," said Griffin, whose father is from Grand Rapids, Minn., and had nine family members in the stands to witness his first win. "I was just trying to compete after the break. It's good to get that first one."
Liriano (3-8) looked unhittable most of Friday. The inconsistent lefty used a diving slider and nasty changeup to fan eight of the first 10 hitters he faced and record nine of his first 10 outs via strikeout.
Twins center fielder Denard Span dropped a fly ball with one out in the fourth and Liriano walked the next batter to load the bases.
Gomes hit Liriano's next pitch into the second deck in left field, his first grand slam this season and third in his career.
"You've got to make the plays," Twins manager Ron Gardenhire said. "You should have been sitting in the dugout and it ends up Gomes coming up in a big situation and got a first pitch that kind of drifted in towards him, inner-half of the plate and he put it in the seats. That's what's disappointing. He should have been in the dugout."
Willingham hit both of his homers -- his 20th and 21st -- off Griffin. The slugger's second blast was a two-run shot that cut his former team's lead to 4-3 in the fourth.
Griffin got a little payback on Willingham in the fifth, striking him out on an off-speed pitch with two runners on to end the inning.
"I went after him, went to 3-2 and continued to trust in the curveball," Griffin said. "That was a huge punch-out for sure. It kept the momentum in our favor."
Ryan Cook struck out two in the ninth for his ninth save in 12 chances.
The win put the A's (44-43) over .500 for the first time since May 21. Oakland entered Friday 2 1-2 games behind Baltimore in the wild card standings.
After starting the season 0-5 with a 9.45 ERA and getting demoted to the bullpen, Liriano is 3-3 and has 76 strikeouts in 52 1/3 innings since rejoining the rotation on May 30.
"When you feel fine, you go out there and you don't think about anything," Liriano said. "And, like I said, they were swinging early and I was making some good pitches when I needed to and just being more consistent throughout this. They can't hit everything."
The A's added a couple of extra runs off Alex Burnett once Liriano was removed after eight innings.
Gomes, who entered the game 4-for-43 against Minnesota, drove in his fifth run with a single. Brandon Inge followed two batters later with another RBI single to make it 6-3.
Cespedes was the A's DH on Friday. Manager Bob Melvin said Cespedes could return to left field on Saturday if his sore left thumb feels better. ... Twins RHP Carl Pavano (shoulder) threw on Friday and is getting closer to throwing off a mound. He said the extended stint on the DL has been frustrating, especially as the Twins have struggled to find capable starting pitching. "I'm letting myself down," he said. "I'm letting everyone down around me." ... The Twins failed to sign ninth-round draft choice L.J. Mazzilli. The 2B and son of former major-league player and manager Lee Mazzilli will return to the University of Connecticut for his senior season. ... Liriano struck out 12 in a game twice during his rookie season in 2006. ... The start of the game was delayed 10 minutes because of rain. ... Cole De Vries makes his sixth career start for the Twins on Saturday. The right-hander is 2-1 with a 3.00 ERA. ... Tommy Milone (8-6) gets the start for Oakland on Saturday. The rookie is 2-1 with a 0.96 ERA over his last four starts.