Tyler Herro scored 29 points, Max Strus added 26 and the Miami Heat rallied to beat the short-handed Detroit Pistons 115-112 on Thursday night.

Strus’ fifth 3-pointer with 40 seconds remaining gave the Heat their final margin.

Cory Joseph’s game-tying 3-point attempt with two seconds left bounced off the rim and was rebounded by Miami reserve forward Udonis Haslem.

Kyle Lowry scored 21 points and Gabe Vincent finished with 15 for the Heat.

Trey Lyles scored a career-high 28 points for the Pistons. Saddiq Bey added 23 points, Joseph scored 21 and Frank Jackson 19.

The Pistons learned hours before the game that Isaiah Stewart, Killian Hayes, Saben Lee and Rodney McGruder entered the league’s health and safety protocols. Rookie Cade Cunningham, the team’s second-leading scorer, was placed in health and safety protocols on Wednesday.

The Heat scored seven unanswered points and went ahead 112-110 on a 3-pointer by Herro with 1:12 remaining.

Bey’s jumper with 59 seconds tied it at 112-all before Strus’ winner.

The Pistons hit a season-high 18 3-pointers.

Miami center Dewayne Dedmon sprained his left knee on a missed short jumper 5:19 into the first quarter and didn’t return. Dedmon’s absence resulted in the eighth appearance of the season by Haslem. The 41-year-old Haslem scored seven points and had five rebounds in 12 minutes.