SAN FRANCISCO — From the outset Thursday night against San Francisco, it was clear that BYU's Matt Carlino was ready to break out of his personal slump.

The freshman guard scored a career-high 30 points, including 22 in the first half, as the Cougars edged the Dons, 85-84, at War Memorial Gym.

The victory aside, Carlino's ability to drain from long distance was a very encouraging sign for BYU.

Carlino had made just 4-of-34 3-pointers in his previous seven games.

"I was due," Carlino said. "They owed me some."

Who owed him?

"The basketball gods," Carlino replied with a smile.

"He came out and shot the ball really well," senior forward Noah Hartsock said of Carlino. "That's what he can bring to this team. He's also a great passer and ball-handler. He showed that tonight. … When he started going, we wanted him to keep going until they stopped him."

Carlino capped the night by driving to the hoop and making the game-winner with 18.9 seconds left.

"Matt made a great shot and sealed the deal," Hartsock said.

Going into the game, coach Dave Rose and his staff challenged the guards to play aggressively.

"Coaches told us to attack their defense," Carlino said. "That's what we did."

FIRST TIME: BYU won at War Memorial Gym for the first time in four tries. Prior to Thursday's win, the most recent setbacks came in 2000 and 2002.

NOTES: BYU shot 53 percent for the game, including 7-of-17 from 3-point territory. … The Cougars hit eight of their first nine shots, including eight in a row. … Forward Nate Austin fouled out with six minutes remaining in the game after scoring six points on 3-of-4 shooting from the field. … Hartsock left the game in the second half with cramps, but returned for the final minutes.