Jamaree Bouyea scored 19 points, and the Dons used a late 8-0 run to beat the Cavaliers 61-60 in the Homelight Classic, part of the "Bubbleville" event at the Mohegan Sun Arena in Connecticut.
USF's last win against a top-5 team was on Dec. 29, 1981, when it beat No. 2 Wichita State 84-74.
"For us to be able to compete like this on a national stage, on national TV, against one of the winningest programs in the country, this is a big, big step for our program," said Todd Golden, the Dons' 35-year-old coach.
Reece Beekman and Justin McKoy each scored 11 points for Virginia (1-1), a 15½-point favorite. Marquette transfer Sam Hauser added 10 points but missed a 3-pointer with 2 seconds left that would have won the game for the Cavaliers.
"Look at it in the mirror, grow from it," Virginia coach Tony Bennett said. "We've got to kind of harden up. We've got to get gritty. We've got to be tougher to score against and be the best version of ourselves."
Virginia led by three points at halftime and scored the first four points of the second half to take a 28-21 lead. But San Francisco went on an 11-0 run from there.
There were 11 lead changes and five ties in the game as neither team could get much separation.
A jumper by Hauser put Virginia ahead 54-53 with 3:42 left, but that would be its last lead of the game.
A strip by Bouyea led to a 3-pointer from Shabazz that gave the Dons a 58-54 advantage, and Jurkatamm made it 61-54 with a 3-pointer the next trip down the court.
UVa chipped away and had a chance to win after Josh Kunen missed the front end of a 1-and-1 with 10 seconds left.
But Hauser's attempt fell off the rim and Trey Murphy III couldn't convert a tip just before the buzzer.
"Nothing is assumed because of what's on the front of your jersey," Bennett said.
The Dons were a national power when Bill Russell roamed the lane, winning national titles in 1955 and 1956. But the program was shut down for three years in the 1980s after a series of off-the-court issues.
"This win for the program is really, really big for us," Bouyea said. "I've been here for four years, and this is probably the best team I've played in four years. To beat them and just have an amazing performance is wonderful."
STATS OF THE GAME
The Dons hit 13 of their 28 3-point attempts (46%) while holding Virginia to 3 of 12 from behind the arc. The Cavaliers had just five assists on 21 baskets.
Virginia: The Cavaliers routed Towson 89-54 on Wednesday in the opening Bubbleville game. But on Friday, Virginia's offense looked a bit more like it did last season, when it averaged 57 points a game. Virginia scored 70 points just twice during the 2019-20 campaign, both times in losses, and never reached 80 points.
San Francisco: The Dons have improved over each of the three straight days they've played. They dropped their opener 76-68 to UMass Lowell, a game in which they were heavy favorites, then beat Towson 79-68 on Thursday.
Virginia: Plays its home opener on Tuesday against Saint Francis (Pennsylvania).
San Francisco: The Dons are scheduled to play their fourth game in five days in Bubbleville on Sunday, taking on Rhode Island.