LOUISVILLE, Ky. (AP) -- Kentucky guard Janee Thompson had only a passing knowledge of the rivalry between the Wildcats and Louisville.
The freshman from Chicago ended Sunday night with a prominent place in the history between the two teams.
Thompson came off the bench to score 13 second-half points, including the game-winning 3-pointer with 8.4 seconds remaining, to lift No. 9 Kentucky to a 48-47 comeback victory at No. 6 Louisville.
''I looked at the clock and there wasn't a lot of time left,'' Thompson said of her step-back 3-pointer as the shot clock expired.
''I couldn't think of a play to run, so I was pretty much trying to create my own shot.''
Thompson also converted three free throws with 59.5 seconds remaining to score the final six points and close a 27-12 run for Kentucky (6-1), which earned its second straight win over Louisville and its first road win in the series since 1999. The Wildcats lead the series 31-18.
''We knew it was coming, but it just hit us in the face,'' Louisville guard Shoni Schimmel said of Kentucky's run.
But the Wildcats never figured on a rookie such as Thompson deciding the game. Kentucky didn't have a play designed for the game-winner, and star guard A'dia Mathies looked on as Thompson dribbled for nearly 20 seconds before taking the 3-pointer.
''Big props to Janee,'' Kentucky star guard A'dia Mathies said. ''I don't think she would've heard the end of it if she didn't hit the shot.''
Considering Kentucky's rough first half shooting (28 percent), coach Matthew Mitchell asked his assistant coaches for a name on who might provide an offensive spark.
The Wildcats found it in the 5-foot-7 guard, who entered the game averaging just 5.2 points per game. It helped Kentucky win despite shooting 33 percent while committing 23 turnovers.
''The game was so tight and so tough,'' Mitchell said. ''We needed somebody that would come in and assert themselves offensively, and she certainly did that.''
Thompson wasn't the only Kentucky new to the rivalry who ended up factoring in the outcome.
Junior center DeNesha Stallworth scored a game-high 14 points and grabbed five rebounds. She sat out last year's game per NCAA transfer rules after starting every game in two years at California.
''I was just trying to stay aggressive,'' Stallworth said. ''Shots weren't going in, so just trying to get the basket was my main goal.''
After Thompson's 3-pointer, Louisville (8-1) had one final chance, but Bria Smith's lay-up was blocked by Azia Bishop just before the buzzer.
That summed up the final 4:54 for the Cardinals, who shot just 38 percent from the field and committed 25 turnovers.
Louisville's last basket, a 3-pointer by Sara Hammond, came after extensive video review by officials. The Cardinals inbounded the ball with two seconds left on the shot clock and the horn went off before anyone touched the ball.
Officials needed several moments to review video before Hammond's 3-pointer was confirmed.
Hammond's shot, with 4:54 remaining, turned out to be the Cardinals' final bucket and they missed three of six free throws down the stretch.
''We gave them the ball game,'' Louisville coach Jeff Walz said of his team missing free throws.
The close victory helped Kentucky win its fifth in a row and earn its first win against a ranked opponent this season. The Wildcats lost 85-51 at No. 1 Baylor in its second game.
It was also the closest margin in six games between the intrastate rivals. The average margin of victory before Sunday was 22 points.
Both teams have conference and national championship aspirations, but both coaches were looking at this game as a measuring stick for their respective teams.
Walz said his players were hurting but the sting of the rivalry loss will be forgotten if they achieve their goal of reaching the Final Four.
''Sure, it's a big game, but it's nine games into the year,'' Walz said. ''Does it hurt that we lost? Of course it does. But I don't care (who) we're playing right now.''
For now the Cardinals will have to deal with losing bragging rights to the Wildcats, who had the final word in this game - before 15,453 on Louisville's home court yet.
''They played a full 40 minutes and it took every bit of it,'' Mitchell said of his team.
AP Freelance Writer Josh Abner in Louisville contributed to this report.