LONG BEACH, Calif. (AP) -- Tyler Lamb hardly looked as though he hadn't played a college game in nearly a year.
The UCLA transfer scored 18 of his 20 points in the first half of his first game for Long Beach State, and Mike Caffey made the winning layup with 16 seconds left to give the 49ers a 72-71 victory over Southern California on Thursday night, ending their nine-game skid.
Caffey scored 22 points for the 49ers (2-9), who beat a Pac-12 team for the first time in three tries after earlier road losses to Arizona and Washington. He found a trusted sidekick in Lamb, whose explosive offense forced the Trojans to guard him in the second half as much as they did Caffey.
''I've been through a lot with USC. I've only lost to them once since I've been in college and I want to keep it that way,'' said Lamb, a junior who left UCLA last January after two strong seasons in Westwood. ''We knew what was on the line. The team was 1-9 and we needed that win. We stuck in there and pulled it out big.''
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. USC's leading scorer who averages 17.3 points was a late scratch from the starting lineup by coach Andy Enfield. Wesley finished with two points in 21 minutes.
''It's always hard when you're not out there,'' Wesley said. ''A lot of credit to Long Beach State. They played great. Mike and Tyler were really good.''
Pe'Shon Howard, who led USC with 19 points, saw his jumper bounce off the rim with 24 seconds to go and the Trojans clinging to a 71-70 lead.
''It was online but I had a problem all day with leaning back on my shot,'' Howard said.
Omar Oraby added 17 points and 10 rebounds for the Trojans (7-3), who fell to 2-12 in their last 14 non-conference road games. They came in having won seven of their previous nine.
''We grinded it out every possession,'' Howard said. ''They didn't back down at all. We learn from it. It showed us how much we've grown up.''
Wesley's potential go-ahead jumper at the buzzer missed and he bent over, his head in his hands and his ears full from the noisy crowd of 4,410 at Walter Pyramid.
''We knew they were desperate for a win because they'd been close so many times,'' Enfield said. ''We could have stole it at the end.''
The 49ers were playing their first game since Dec. 7 when they lost at North Carolina State, part of their tough early season schedule that has included losses to Kansas State (twice), Michigan, VCU and Creighton.
''Winning is a progression,'' 49ers coach Dan Monson said. ''You have to believe you're going to win. That's what good teams do. We're not a good team yet but our team grew a lot.''
They took it to USC early, shooting 54 percent from the floor in building a 50-36 halftime lead. The 49ers trailed by five to open the game and then outscored the Trojans 26-9 to lead 28-16. Lamb came into the game during the run and contributed nine points. The 49ers closed the spurt with 10 straight points, including consecutive 3-pointers by Kris Gulley and McKay LaSalle.
The Trojans shot 41 percent and had seven turnovers in the half.
''We played our best half of basketball in the first half and then reverted back a little bit. That happens,'' Monson said. ''Tyler Lamb was a big lift. You get a guy who hasn't played in a year so you don't know if you're going to play him 2 minutes or 20 minutes. He was very impressive for 20 minutes. He gives us another player who wants the ball. Hopefully we can become a better team as he gets comfortable.''
Caffey's basket to start the second half gave Long Beach State its largest lead of the game, 50-36. The 49ers were up 62-49 when USC ran off 11 straight points to close to 62-60. Howard hit two free throws and made his fifth 3-pointer of the game in the spurt that saw the Trojans crash the boards and disrupt Long Beach State's offensive flow.
The 49ers twice extended their lead to six points before USC cut it to 68-66 on Oraby's dunk.
Caffey answered with the first of the 49ers' final two baskets to make it 70-66.
''It helped out a lot,'' he said about having Lamb in the lineup. ''Not only was he a scorer but he's a leader. Defensively he helped out a lot on that. He was just a big impact on the game.''
USC then scored five in a row to take its first lead, 71-70 since early in the game. Oraby fought off two defenders to score inside, got fouled and made the free throw. Julian Jacobs stole the ball from Caffey near midcourt and scored on a fast-break layup for the lead.
Lamb lost the ball out of bounds near the baseline when it went off his foot, but the Trojans had a shot-clock violation.
Caffey took the ball from the opposite end to score the go-ahead layup and USC missed its final two shots.