The Longhorns led 62-60 before a ringing 3-pointer by Khris Lane with 3:52 to play handed VCU its first lead of the game, bringing the Rams all the way back from a 19-point, early second-half deficit.
Mohamed Bamba, who racked up 13 points and 13 rebounds, hit two free throws with 1:34 to push Texas back to the lead at 64-63 and, after a VCU missed shot, Osetkowski poured in his third shot from beyond the arc. He had just two 3-pointers in the Longhorns' first seven games this season.
The Longhorns (6-2) persevered by making free throws down the stretch and won their first true road game since the 2015-16 season after going 0-11 last year.
The game was a return to Richmond for Texas coach Shaka Smart, who coached VCU for six seasons, including a trip to the Final Four in 2011. The Longhorns' trip to Richmond was a condition of Smart's contract with the Longhorns. The Rams are now coached Mike Rhoades, who was one of Smart's assistants at VCU.
Andrew Jones led Texas with 19 points and Eric Davis had 11, including three free throws in the final 30 seconds.
VCU's Justin Tillman led all scorers with 22 points while Kane added 15 and De'Riante Jenkins scored 12 for the Rams (5-4). Tillman also took 10 rebounds to pace VCU.
Texas scored 12 of the game's first 14 points and led by as many as 14 in the first half before settling for a 40-32 advantage behind 15 points from Jones and 10 from Osetkowski. Tillman led the Rams with 15 points.
Texas started the second half with a 17-6 run that stoked its lead to 57-38. But five straight points in the paint by Tillman brought the Rams back to within 61-55 with 6:17 to play, and a layup by Marcus Santos-Silva a minute and a half later cut the Longhorns' lead to just two points, setting the table for the furious finish.
The Longhorns' two losses this season are to No. 1 Duke and 12th-ranked Gonzaga in the PK80 Classic tournament in Portland, Ore., both in overtime.