STANFORD >> Stanford coach Troy Taylor told the seniors to make their last game at Stanford Stadium one that they’ll never forget. The whole team took it to heart.

Stanford snapped a six-game losing streak and won its first home game over an FBS team in the Taylor era in improbable fashion. The Cardinal overcame a 14-point fourth-quarter deficit, and senior Emmet Kenney kicked a career-long 52-yard field goal as time expired as Stanford defeated No. 22 Louisville 38-35 on Saturday.

“In life you know the first time you do something, but usually you don’t know the last time you do something,” Taylor said. “For a lot of these guys, it’s the last time playing at Stanford Stadium. We talked about breathing it in, enjoying it, and then making it memorable, and we certainly did that.”

Emmett Mosley V had the most productive game for a true freshman receiver in program history, catching 13 passes for 168 yards and three touchdowns. He caught two fourth-quarter TDs in the final seven minutes, including a 4-yard pass from Ashton Daniels on fourth-and-goal and then a 25-yard pass from wildcat QB Justin Lamson on fourth-and-1 with 45 seconds left, allowing Stanford (3-7, 2-5) to tie the game at 35.

The Stanford defense was missing sixth-year linebacker and captain Tristan Sinclair and junior Collin Wright, its best player in coverage, who were both injured. But the unit, which is last in the ACC in points allowed, forced Louisville to turn the ball over on downs at the Stanford 45 with five seconds left.

Louisville (6-4, 4-3), a 21-point favorite, then self-destructed to allow the shocking upset. Louisville committed a personal foul penalty on a 1-yard reception by Mosley to set up a 57-yard field goal attempt with one second left. Then a Louisville player jumped offsides to move the ball five yards closer.

Kenney, who came to The Farm from Fargo, North Dakota but spent his first three years either injured or backing up current Los Angeles Rams kicker Joshua Karty, then nailed a career-best kick on senior day, sending the players and a small group of students storming onto the field.

Kenney hit a 39-yard field goal as time expired as Stanford won its first-ever ACC game 26-24 at Syracuse. The Cardinal hadn’t won since, including five losses by at least 24 points.