And the Nuggets needed it to overcome Ben Gordon's record-tying night from 3-point range.
McGee soared into the lane to rebound a teammate's missed free throw and dunk with 5 seconds remaining, and the Nuggets withstood Gordon's season-high 45 points for a 116-115 victory over the Detroit Pistons on Wednesday night.
McGee's rebound and slam followed a missed foul shot by Arron Afflalo, who was fouled while making a driving layup with 5.6 seconds left. That basket pulled the Nuggets within 115-114 after they had blown a 25-point lead.
"I didn't think Arron was going to miss the free throw, but if he did, as long as I went hard, I figured I'd maybe get the tip-in or at least the tip out," said McGee, playing in his first game since being acquired by Denver a week ago in the trade that sentNene to Washington.
"I just went hard and pushed (Greg) Monroe under the rim and I was wide open. It bounced and bounced and I was trying not to goaltend it and I just dunked it. It was definitely exciting, my first game winner. I'm definitely excited to be in Denver, my new home."
Afflalo went from dismay over missing the foul shot to relief once he saw McGee flying through the lane to grab the rebound and put it back in.
"I'm very happy he made a great play," Afflalo said. "Forget my free-throw percentage. I'll take the 'W' any time. You want to come through in those moments, but if we could plan that, I would do it again."
Gordon, who tied the NBA record by going 9 of 9 behind the arc, said the loss was especially tough to take after coming all the way back.
"We had our shots, we just had two bad possessions at the end," Gordon said. "Obviously the Afflalo drive; we fouled him while he was driving to the basket while we were up three. Should have just let him get the two. And the tip dunk by McGee. It came off the rim so fast and he got up there."
Ty Lawson led the Nuggets with 25 points and Afflalo had 23. McGee finished with 15.
"I'm sure it's a proud moment for him, coming here and in the first game that he plays in, to win a game," Nuggets coach George Karl said of McGee. "It's pretty classy, a pretty good chapter."
The Pistons trailed 45-20 early in the second quarter, but took their first lead 78-76 on Gordon's eighth 3-pointer with 5:48 left in the third quarter.
Knight hit a 16-foot jumper less than three minutes later that gave Detroit a six-point lead, but Afflalo hit a 3-pointer and, after being fouled on a shot from beyond the arc, hit all three free throws to tie it at 91 going into the fourth.
Gordon's ninth 3-pointer gave the Pistons a 112-109 lead with 2:51 to play. After Wilson Chandler drove in for a layup, Knight hit a 3-pointer for Detroit for a four-point lead.
Gordon got off a long jumper at the buzzer but it hit the back of the rim and bounced away.
"It's a painful, painful way to lose," Pistons coach Lawrence Frank said. "We put ourselves in a position to win and we put ourselves in a position to lose. It's one or two plays that can determine if you win the game or sweep the trip. We're not quite ready for it yet. It's going to take some painful experiences like this."
The Nuggets led 62-57 at the half after being outscored 39-22 in the second period. Gordon scored 21 points in the quarter, going 5 for 5 from 3-point range.
The Pistons were without Rodney Stuckey, who was rested because of lingering soreness in his left big toe. ... Gordon scored a career-high 48 points against Milwaukee on March 4, 2007, while with Chicago. ... With Chandler starting in place of injured Danilo Gallinari (thumb), the Nuggets have used 18 different starting lineups this season.
Kevin Love is now 4-for-4 after draining a 3-pointer from the corner.
J.R. Smith drains a 3-pointer from deep in the first quarter against the Raptors.
Bismack Biyombo drains a jumper early in the first quarter against the Cavs.