Reece Beekman scored 11 of his 15 points in the second half and added 12 rebounds, five assists and five steals as Virginia (18-12, 12-8 Atlantic Coast Conference) snapped a two-game losing streak.
Another reserve, Kody Stattmann, also boosted the Cavaliers and tied his career high with 11 points. Armaan Franklin contributed 13 points for Virginia, which might need a deep run next week in the ACC tournament to reach the NCAA Tournament.
It was the 11th loss in the last 12 games for Louisville (12-18, 6-14) after a 4-0 start in the league. Sydney Curry led the Cardinals with 24 points and 14 rebounds. Malik Williams added 10 points and seven boards.
Louisville scored the game's first eight points as Virginia failed to get on the board in the first four minutes. But after trailing 10-2, the Cavaliers dominated the rest of the half, outscoring the Cardinals 34-7.
Shedrick tallied 16 of those points, rampaging for five dunks and a pair of three-point plays as he made all seven of his field-goal attempts in the half.
During an 18-0 run late in the half, Shedrick had a slam putback and later delivered the final seven points of the burst. Kihei Clark also fueled the surge on consecutive possessions with a 3-pointer and a fadeaway jumper as Virginia took a 36-17 halftime lead.
After the break, Louisville showed some life as it outscored Virginia 12-3. Mason Faulkner and Noah Locke drilled 3-pointers as the Cardinals sliced the deficit to 39-29.
With 7:10 left, Virginia hiked its lead back to 58-41 as Beekman buried 3-pointers on back-to-back possessions.
The Cardinals had one last surge in them as Locke made a 3-pointer and Curry followed with a pair of three-point plays as Louisville got the deficit into single digits, 58-50.
But in the final six minutes, Franklin made 5 of 6 free throws and Beekman drained another 3-pointer to steady the Cavaliers.