The Terriers (6-6) already had a victory over an SEC team this season, beating Georgia 60-57 on the road Nov. 17.
This time they were not going to be denied in the Gamecocks' second visit in the past 50 years.
Clinging to a one-point lead with 2 minutes remaining, the Terriers went on a 9-0 run as the Gamecocks missed four shots in a row. Seven of the points came from the free-throw line as South Carolina missed three 3-pointers and a jumper during that time frame.
Jamar Diggs finished with 16 points and made 5 of 8 from the foul line. Dahlman added 11 rebounds as the smaller Terriers outrebounded South Carolina 43-33.
Devan Downey led the Gamecocks (7-3) with 17 points.