New Mexico dropped in the polls earlier this week, but the No. 20 Lobos' confidence never wavered.
Cameron Bairstow scored 17 points as New Mexico rebounded from a loss to San Diego State last Saturday to beat Wyoming 63-59 on Wednesday night.
Hugh Greenwood added 13, including four in the last eight seconds, Kendall Williams 12 and Alex Kirk 10 for the Lobos (18-3, 5-1 Mountain West).
"We did have that swagger," Greenwood said. "We're still 20th in the country and we've got guys who can really score and really defend and really play this game. You always have to be confident. We took a hit, but to come out here and get a win and respond is really what this thing's all about."
New Mexico has won 10 of its last 12 games against Wyoming and five of the last six in Laramie.
The Cowboys (15-5, 2-5) have lost three straight. Wyoming was led by Derrious Gilmore's 15 points, all of which came on 3-pointers. Riley Grabau and Leonard Washington had 11 apiece. Wyoming hit 12-of-22 3-pointers in the game, but New Mexico dominated play in the paint — outscoring the Cowboys 28-12 inside and winning the boards 35-23.
Wyoming's two inside threats — Washington and Larry Nance Jr. — were a combined 7-for-21 from the field.
"They wall up really well with their hands up and we just didn't finish inside," Wyoming coach Larry Shyatt said.
Wyoming led 28-27 at the half thanks primarily to its 7-of-10 shooting from 3-point range. Gilmore hit three treys, and Grabau two.
The Cowboys started the second half with two free throws by Nance for a 30-27 lead, but the Lobos went on an 8-0 run for a five-point advantage.
New Mexico went up by as many as nine points in the second half before Wyoming tied the game at 59-all on Grabau's 3-pointer with 23 seconds left.
But Greenwood hit a jumper with 8 seconds left and sank two free throws a second later after Wyoming turned the ball over when Washington overthrew everyone on an in-bounds pass.
"Hugh Greenwood has made big shot after big shot," New Mexico coach Steve Alford said. "Hugh's had games where he's not made anything and yet in the last 5 minutes he'll come up with the big shot or the big free throw and today I thought he was really good throughout."