LEXINGTON, Ky. (AP) - Austin MacGinnis kicked a season-long 51-yard field goal as time expired to lift Kentucky to a 40-38 win over Mississippi State on Saturday night and end a seven-game skid.
MacGinnis also made field goals of 46, 32 and 32 yards but missed a 28-yard attempt Kentucky's opening series.
Mississippi State trailed 34-24 with 14:57 remaining, but used two late touchdowns to make things interesting down the stretch, setting the tone for the exciting finish.
Kentucky's Stephen Johnson was 17-of-33 passing for 292 yards and two touchdowns but had two fumbles, both resulting in touchdowns for the Bulldogs, including one that led to an 81-yard touchdown run by Mark McLaurin that pulled the Bulldogs within 34-31 with 9:33 remaining.
The Wildcats (4-3, 3-2 Southeastern Conference) need two wins - with five games remaining in the regular season - to become bowl eligible for the first time since 2010.
It was Kentucky's first win over Mississippi State (2-5, 1-3) since 2008 and marked the first time the Wildcats have won three or more conference games since the 2009 season.
The loss was the third straight for the Bulldogs, who have struggled without former standout Dak Prescott, now turning heads in the NFL with the Dallas Cowboys.
Jeff Badet hauled in seven passes for 139 yards - including touchdowns of 44 and 40 yards - for Kentucky. Benny Snell added 128 yards rushing and one touchdown.
Kentucky finished with 554 total yards and limited the Bulldogs to just 362 yards.
Kentucky pulled within 14-12 on a double reverse out of the Wildcat formation from Snell to Ryan Timmons, to Johnson, who capped the play with a 44-yard touchdown strike to Badet to open the second half.
The Wildcats took their first lead on Snell's 34-yard touchdown run on Kentucky's second series of the half. Johnson's two-point conversion pass to Tevin Richardson gave the Wildcats a 20-17 lead with 6:26 remaining in the third quarter.
Fitzgerald paced Mississippi State's offense with 107 yards rushing and two touchdowns, including a 7-yard strike to Fred Ross to give the Bulldogs a 38-37 lead with 1:09 remaining.
Mississippi State offensive guard Darryl Williams, a redshirt freshman, went down with a an injury during a field goal attempt in the second half and was carried off the field in a stretcher at the 9:37 mark of the third quarter.
Williams was transported to nearby UK Chandler Medical Center for further evaluation. According to MSU spokesman Bill Martin, Williams had movement in all of his extremities.
Kentucky: The Wildcats have won four of their past five games after opening the season with two straight losses. Kentucky took sole possession of second place in the SEC East with the win over the Bulldogs, a game ahead of No. 18 Tennessee, which was idle this week.
Mississippi State: The Bulldogs' streak of six straight postseason appearances appears to be in jeopardy with five games remaining in the season. Mississippi State has yet to play SEC West foes Alabama, Texas A&M, Arkansas and Mississippi. Coach Dan Mullen suffered his first loss to the Wildcats.
Kentucky is at Missouri Saturday.
Mississippi State hosts Samford.
(Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)