USC point guard Jordan McLaughlin returned Sunday night after sitting out two games because of a shoulder injury.
The freshman did not start, but after helping the Trojans rally to within one point of Stanford, he had the ball in his hands in the final seconds with a chance to win the game.
"That's why I came here," he said. "That's what everyone lives for."
Unfortunately for the Trojans, McLaughlin slipped in the lane on a drive to the basket and the Cardinal stole the ball.
Stanford hung on for a 78-76 Pacific 12 Conference victory at the Galen Center.
USC fell to 9-7 overall and 1-3 in the Pac-12.
"We had a chance to win it," USC Coach Andy Enfield said. "As a coach that's all you can ask for."
One game after leading nearly start to finish in a victory over California, USC almost came back from a 13-point second-half deficit against the Cardinal.
But the Trojans could not overcome a Stanford team that made 10 of 25 three-point shots, including nine of 13 in the first half.
Guard Anthony Brown scored 21 points for Stanford, which improved to 11-4 and 3-1 in the Pac-12.
Enfield was encouraged by his team's effort.
"You see the potential in our young players," he said. "That's a very positive sign."
The Trojans were happy to welcome back McLaughlin, who suffered a shoulder injury during a Jan. 2 loss at Utah.
The former Etiwanda High star sat out against Colorado and Cal, and he entered Sunday night's game about 31/2 minutes into the first half.
McLaughlin missed his first three shots.
"I was kind of jumpy," he said.
He regrouped after a few minutes on the bench and finished the game with 14 points, including several down the stretch to put the Trojans within striking distance.
Stanford had extended a 49-43 halftime lead to 75-62 with just less than seven minutes left.
USC freshman guard Elijah Stewart's dunk cut the margin to 77-71, and McLaughlin's steal and ensuing free throws pulled USC to within 77-74 with 1:27left.
After Brown missed a three-pointer from the right corner, Stewart rebounded and fed McLaughlin for a layup that made the score 77-76.
Malik Marquetti rebounded another Brown miss and USC called timeout with eight seconds left to set up its final play.
"You put the ball in the freshman's hands at the end, and you have a chance to win the game," Enfield said. "We'll take that."
McLaughlin received the inbounds pass near half court and drove the right side of the lane looking to either launch a floater or make a pass. But he lost his footing, and Stanford center Stefan Nastic stole the ball and was fouled.
"When I crossed over, I just slipped," McLaughlin said.
Nastic made one free throw, then missed the second, and Stewart's desperation shot fell short.
The Trojans now look to Wednesday night, when they will play UCLA at the Galen Center.
"It should be a fun game," McLaughlin said. "Fun and exciting."