Wilfredo Lee, Associated Press
Miami Heat guard Ray Allen, left, celebrates with forward LeBron James (6) after Allen scored in the final seconds of the second half of an NBA basketball game against the Denver Nuggets, Saturday, Nov. 3, 2012 in Miami. Allen had a four-point play with 6.7 seconds left that put Miami ahead for good, Chris Bosh scored 40 points and the Heat held off the Denver Nuggets 119-116.

MIAMI — Ray Allen was left unguarded for about one second.

Big mistake.

And his first game-winner for the Miami Heat was one to remember.

Allen got a pass from LeBron James and converted a four-point play with 6.7 seconds left that put Miami ahead for good, and Chris Bosh scored 40 points to help the Heat hold off the Denver Nuggets 119-116 on Saturday night.

"LeBron found me," Allen said after just his third game with the Heat. "It was curtains."

The league's reigning MVP and its career leader in 3-point shooting combined to put Corey Brewer in a bad spot on Miami's last possession of the night.

Trailing by a point with 14.1 seconds left, the Heat called time out and designed a play where James would have the ball and the option to either drive or pass. He had just scored by driving the left side of the lane moments earlier, and started his move on the deciding possession by going in that same direction.

Brewer, who was shadowing Allen, saw James' drive and moved in for help. That left Allen alone, and he slipped to the left corner — one of his favorite spots on the floor. James threw him the ball, Allen got the shot off as a late-arriving Brewer fouled him, and yet another sellout crowd in Miami got a wild finish to a wild game.

"We've been on the other end, as the recipient of that type of pain, in the locker room when he puts the dagger to your heart with a 3 — and the and-one, just for the heck of it," Heat coach Erik Spoelstra said. "Do we expect him to do that every single night? That's not necessarily what he has to do. It's what he's done his whole career, but he's found a way to fit in."

Allen scored 23 points, and James finished with 20 points, 11 assists and nine rebounds for the Heat, who escaped when Danilo Gallinari's 3-point try with 2 seconds left bounced off the rim.

Gallinari finished 3 for 17 from the floor, 1 for 9 from 3-point range.

"The timing wasn't right," Gallinari said.

Dwyane Wade added 14 points for Miami (2-1).

Kenneth Faried and Andre Iguodala each scored 22 for Denver, which fell to 0-3. Andre Miller made his first eight shots and finished with 17 for the Nuggets, who also got 16 points from JaVale McGee and outrebounded Miami 47-32.

"Right now we just need to get a win," Nuggets coach George Karl said. "This would have been a great win for us. It would have salvaged the trip. It doesn't feel good. It never feels good."

The 40 points were a Heat-high for Bosh, and they needed every one of them.

"Good teams find a way to win," Bosh said. "We haven't been playing our best basketball. We know we've gotten off to a slow start defensively. We have to pick that up. We have to make a better. I'm just glad we got out of here alive tonight."

It was a frantic last 3 minutes, and Denver seemed to take control in the final moments. Faried grabbed a rebound and scored with 49 seconds remaining, and after a Denver stop, the Nuggets took the lead when Iguodala connected over Wade from the left wing with 14.1 left on the clock for a 116-115 edge.

So for the first time this season, the Heat faced a last-second situation.

James and Allen — teammates now for all of three games — were in perfect synch. Allen made the shot, the free throw swished, the Heat lead was three, and they escaped.

"As I stepped up to the free-throw line, I was like, 'Please make this free throw,'" Allen said. "It'll be a better story to tell."

Denver was up six midway through the fourth quarter, but the Heat erased the deficit in a hurry on a pair of 3-pointers by Allen, 41 seconds apart.

At various times in the early going, Denver held a 40-10 edge in points in the paint, a 12-0 advantage in second-chance points, and Faried and McGee were shooting a combined 13 for 16 in the game's first 20 minutes. By halftime, it was 66-64, the Nuggets having scored one more point than what anyone posted in the first half of any game against Miami last season, playoffs included.

Ultimately, the 23rd — and final — lead change of the night was pulled off by Allen and the Heat.

"It's good that he made them in a white and red uniform," Wade said.

NOTES: Denver didn't score more than 89 points in either of its first two outings this season — it had 91 by the end of the third quarter on Saturday. ... Miami has allowed 175 points in the first halves of its three games. ... The Heat shook up the rotation, with Norris Cole essentially being swapped out and replaced by Mike Miller. Heat backup C Joel Anthony also made his first appearance of the season, after battling a hamstring issue since training camp.