The Golden Bears (14-9, 4-6 Pac-12) led most of the game but trailed 66-61 with 2:04 left before rallying to win their third in a row.
David Kravish scored on a short hook shot to give Cal the lead with 41 seconds to play. After Katin Reinhardt's 19-foot jumper put the Trojans (9-13, 1-9) up 68-67, Wallace missed the front end of a one-and-one with 9.7 seconds remaining.
The Bears' leading scorer got redemption moments later after Jordan McLaughlin made one free throw for USC with 4.9 seconds left. Cal got ball to Wallace, who rushed toward the three-point line before pulling up and making the game-winner. That set off a frenzy near midcourt as fans and students poured out of the stands and rushed the court.
Wallace finished with 18 points, Kravish had 15 points and eight rebounds, and Jordan Mathews added 12 points for the Bears.
McLaughlin scored 20 points for the Trojans, who have lost seven in a row since beating the Bears on Jan. 7.
USC was in position to complete the season sweep, but the Trojans missed four shots down the stretch, not to mention McLaughlin's critical free throw in the final seconds.
USC has lost 16 of its last 17 conference road games.
Sunday at Stanford, 5:30 p.m., ESPNU — The Trojans catch the Cardinal on a small cold streak: Stanford has dropped consecutive games for the first time all season.