Mike Caffey scored 22 points and made the winning layup with 16 seconds left, giving Long Beach State a 72-71 victory over Southern California that snapped the 49ers' nine-game skid on Thursday night.
Byron Wesley's jumper missed at the buzzer for the Trojans, who erased a 16-point deficit in the second half only to fall to 0-2 on the road.
Tyler Lamb scored 18 of his 20 points in the first half of his first game for the 49ers after transferring from UCLA last January.
The 49ers (2-9) beat a Pac-12 team for the first time in three tries this season after earlier road losses to Arizona and Washington.