The No. 19 Wildcats had bookend three-run frames in the first and ninth innings in support of A.J. Reed's seventh win on the mound.
Texas A&M (23-16, 7-9 SEC) answered with three runs in the bottom of the second as the Cats and Aggies appeared to be headed for a high-scoring affair, but the score remained locked at 3 after eight innings.
JaVon Shelby singled to get the Cats' winning ninth started. After a sacrifice bunt by Austin Cousino, Max Kuhn was hit by a pitch. Both runners moved up on a wild pitch, forcing the Aggies to intentionally walk the SEC's top hitter, Reed.
The Aggies' Corey Ray got what appeared to be a huge strikeout of UK's Thomas for the second out, but Tom responded with a two-out single to right field to drive in Shelby with the go-ahead run. Bernal followed with a two-run single up the middle to give the Cats two insurance runs.
Kyle Cody replaced Reed after A&M got a lead-off single in the ninth. He induced three ground outs to give UK the win and pick up his fourth save of the season.
Ray (4-3) took the loss for the Aggies, giving up three earned runs on three hits, two walks and two hit batsmen over 1.2 innings of work. Kentucky knocked out A&M starter Jason Jester after only one-third of an inning, roughing him up for three runs on four hits and two walks.
Bernal went 3-for-5 with four RBI to lead UK at the plate. Shelby had two hits.