The Aztecs did not score a field goal over the last eight minutes, scoring their final 13 points from the foul line to fight off the upset bid.
San Diego State made just 18 field goals and shot 33 percent, but turned the ball over just four times while remaining unbeaten in the Mountain West Conference.
Thames went 8-of-13 from the field and Winston Shepard was the only other member of the Aztecs in double figures with 17 points.
San Diego State is 15-1 for the season and 4-0 in conference action.
Fresno State (8-10, 1-4 MWC) was led by Tyler Johnson with 24 points and 11 rebounds.