The game was tied at 60 before Ingram's layup with 33 seconds remaining. The 6-foot-7 freshman, who leads the Cardinal in scoring and rebounding, said they added the play that led to the decisive basket during practice last week.
"It was a high ball screen. Get the ball in the high post, put a shooter in both corners and attack the rim," Ingram said.
USC's Isaiah Mobley got to the line on a loose ball foul with 14 seconds left but missed the second free throw. Brandon Angel hit his two foul shots three seconds later to put the Cardinal up by three.
The Trojans had a chance to send it to overtime but Mobley missed a 3-pointer with one second left.
"I felt like I got a good look on the last shot. I didn't see Boogie (Ellis) open in the corner. I had a good look, it didn't go down," said Mobley, who was held to nine points.
The game was similar to the first meeting, which the Cardinal won 75-69 on Jan. 11. Stanford made nine 3-pointers again, limited USC's offensive rebounds and found a way to break through in the end.
"It's going to be hard for anybody to beat USC if you don't make a fair number of 3s," Stanford coach Jerod Haase said. "They're so big, long and good inside that you have to be able to make plays from the outside.
"This is the kind of game where a couple plays go your way and you talk about how tough you are and how resilient, but the truth is they were, too."
Spencer Jones had 10 points for Stanford (12-6, 5-3 Pac-12), which has won two straight following three consecutive losses.
Drew Peterson led USC (16-3, 6-3) in scoring for the third straight game with 14 points, and Ellis scored 11.
"We can't take these games for granted," Peterson said. "We have to read the scouting report and know their shooters. We allowed a couple open 3-pointers. We have to lock in on the details because teams are keeping it close."
Stanford trailed for most of the second half before scoring eight straight points to take a 60-55 lead with 2:46 remaining. Max Agbonkpolo's jumper ended a seven-minute USC scoring drought, and Peterson tied it on a 3-pointer with 55 seconds left after the Trojans forced a shot clock violation.
Stanford got off to a fast start and led 16-7 less than seven minutes into the game on eight points and a pair of 3-pointers by Delaire.
The Cardinal were up 26-19 with 6:45 remaining in the first half before the Trojans scored 15 straight points. USC was 5 of 7 from the floor and hit three 3-pointers during the run while Stanford missed 12 shots in a row and committed a pair of turnovers.
Ellis scored six points, all from beyond the arc, and Kobe Johnson added four.
Delaire's dunk broke a nearly six-minute scoring drought for Stanford, but it went into the half trailing 34-28.
USC led by five eight minutes into the second half before a 6-1 Stanford run tied it at 50 with 10:42 remaining on Michael O'Connell's 3-pointer.
"We have to do a better job of withstanding what the opposing players do well," USC coach Andy Enfield said. "We missed four layups at the start. I'm disappointed with our upperclassmen. We made errant passes. That was frustrating."
TALE OF TWO HALVES
Stanford shot just 34.6% from the field in the first half (9 of 26) but was 14 of 28 in the final 20 minutes. USC was 13 of 26 in the first half, but 9 for 23 in the second (39.1%).
Ellis appeared to injure his right leg when he went down after attempting a dunk. He went straight to the locker room but returned a couple of minutes later.
Stanford: The Cardinal are squarely on the NCAA Tournament bubble, but this win improved their record to 4-3 against Quad 1 teams.
USC: The Trojans are in a stretch of five games in 10 days and had their three-game winning streak snapped.
Stanford: Remain in Los Angeles to face No. 7 UCLA on Saturday.
USC: Host California on Saturday. The Trojans won the first meeting 77-63 on Jan. 6.
Stanford upsets No. 15 USC after Elijah Mobley can't convert final shot
Stanford heads on the road and beats No. 15 USC after Elijah Mobley can't hit the final shot.