BOSTON — All it took was a return to his NBA roots for Kelly Olynyk to show why he was so enticing to the Miami Heat during last summer’s free agency.

This time he wasn’t trigger shy. This time he was locked and loaded. This time when the Heat needed someone step up, Olynyk stood tallest.

With the Heat power rotation ravaged by injuries, Olynyk stepped up against the team that cast him aside in the offseason in favor of Gordon Hayward, closing with a career-high 32 points against the Boston Celtics in a stunning 90-89 victory at TD Garden.

This victory made as much sense as the Heat losing their previous game to the league-worst Atlanta Hawks on Monday night.

The game was decided when guard Kyrie Irving, who led the Celtics with 33 points, was off with a jumper just before the final buzzer.

The Heat again entered decidedly shorthanded, with center Hassan Whiteside missing his 11th consecutive game with the latest bone bruise on his left knee, Justise Winslow his fourth consecutive game with a strained left knee, and James Johnson and Goran Dragic out for the second consecutive game, Johnson with bursitis in his right ankle and Dragic with a strained left elbow.

That had the Heat, for the second consecutive game opening with Tyler Johnson at point guard, Bam Adebayo at power forward, along with Olynyk at center, Josh Richardson at small forward and Dion Waiters at shooting guard. Waiters played for the second consecutive game feeling the impact of a stomach illness, still unable to keep down food.

The Celtics remained without Hayward, who broke his ankle on opening night and is a question mark to return this season, and also without forward Marcus Morris, due to knee pain.

With Irving refusing to give in to the upset possibility, his driving layup with 2:04 left not only led to a 3-point play that drew the Celtics within 87-81, but also left Olynyk with his fifth foul.

Then, after a botched drive attempt by Waiters, the Celtics got a 3-pointer from Jaylen Brown orchestrated by Irving to bring Boston within 87-84 with 1:31 to play.

With Olynyk then making only one of two free throws on one end, Irving scored to bring the Celtics within 88-86.

That’s when Olynyk eclipsed his previous career high of 30 points with a driving dunk to give the Heat a 90-86 lead.

Then, with 53.8 seconds to play, Brown made one of two free throws to draw Boston within 90-87.

Going for the heroic, Waiters was offer with a 3-point attempt with 37.1 seconds to play, with the Celtics calling time.

Irving then took Richardson off the dribble to bring Boston within 90-89.

Richardson then was badly off with a jumper with 6.2 seconds to play, with the Celtics calling their final timeout.

Irving then was off with his jumper, as time expired.

An Olynyk 3-pointer with 9:54 to play pushed the Heat to a 68-60 lead and forced a Celtics timeout, leaving them with two for the balance of the game. Olynyk followed with another 3-pointer as the Heat later moved up 12.

But Olynyk also was called for his fourth foul with 8:27 to play, with Erik Spoelstra leaving him in the game.

Moments later referee Marc Davis called the fifth and six fouls on Celtics forward Al Horford in a four-second span, disqualifying him with 8:14 to play.

But that also is when Irving began to warm up, his 3-pointer midway through the fourth quarter drawing the Celtics within 79-72 and then a Marcus Smart 3-pointer making it 79-75.

But when Olynyk stepped into another 3-pointer, the Heat went back up 85-75 with 4:04 to play.

Spoelstra got the Celtics out of sorts in the third period when he turned to a zone defense.

A Richardson 3-pointer pulled the Heat within 49-46 midway through the third period, after they previously had trailed by 12. Another Richardson 3-pointer then tied it 49-49, with Waiters scoring inside for a 51-49 Heat lead and Olynyk following inside to make it 53-49.

The Heat eventually moved to a 58-51 lead before Celtics coach Brad Stevens called time, with a Smart 3-pointer later busting the zone.

The Heat went into the fourth up 62-59, with Olynyk up to 18 points at that stage.

The Heat shot of 1 of 12 on 3-pointers in the first half and stood 3 of 11 from the foul line at one point in the second period, practically fortunate to stand within 44-36 at halftime.

To illustrate how upside down it was for the Heat, Wayne Ellington led the team with six rebounds in the first half and Olynyk was tied for the Heat lead in assists at the half with two.

The Heat’s lack of scoring became apparent early, closing the first period 7 of 19 from the field, with no player with more than four points and down 24-15 going into the second period. The Heat shot 0 for 6 on 3-pointers in the opening period, which ended with Smart beating the buzzer with a 3-pointer.

The game concluded the three-game season series, with this the Heat’s lone visit to Boston.

The Celtics won the first meeting, 96-90, Oct. 28 at AmericanAirlines Arena, behind 24 points from Irving, in a game the Heat played without Whiteside. The Heat then snapped the Celtics’ 16-game winning streak with a 104-98 victory Nov. 22, when Dragic scored 27 points and Waiters 26. The Heat had lost eight in a row to the Celtics prior to that victory.

The Heat entered having lost their previous four visits, dropping last season’s two visits by a total of seven points.

The game concluded a two-game trip for the Heat, with seven of their next eight at AmericanAirlines Arena, starting with the Dallas Mavericks on Friday.

The Heat were coming off Monday’s 110-104 loss in Atlanta, which snapped a two-game winning streak.

The game opens a back-to-back set for the Celtics, who play Thursday in New York. The Celtics were coming off Monday’s 112-111 victory in Boston, with victories in three of their previous four.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.