MIAMI (AP) - Kelly Olynyk scored 25 points, including a big layup with 39 seconds left, and Goran Dragic added 24 as the Miami Heat held off the Detroit Pistons 111-104 on Wednesday night.
Olynyk finished with 13 rebounds and Dragic had 13 assists for the Heat, who are three games over .500 for the first time since April 2016.
Josh Richardson scored 22 for Miami, which shot 51 percent and outscored the Pistons 51-27 from 3-point range. James Johnson scored 16, Wayne Ellington had 12 and Hassan Whiteside added 10 for the Heat.
Tobias Harris led a balanced Detroit effort with 19. Reggie Bullock scored 17, Avery Bradley and Boban Marjanovic had 15 apiece, Dwight Buycks scored 14 and Luke Kennard added 13 on 6-for-7 shooting for the Pistons.
The Pistons were without center Andre Drummond, sidelined by a rib injury. That meant Marjanovic made his first start since the end of the 2015-16 season, when he was with San Antonio.
Olynyk's drive with 2:40 left pushed the lead to 105-98, when he took a pass in the high post, let cutters run off him and then turned and did the rest himself.
But what may have been his biggest play came in the final minute, when he extended a Heat possession by tapping an offensive rebound to Richardson. Dragic found Olynyk for a layup to cap that trip, Miami led by five and it finished off the win.
Bullock was 4 for 4 in the third quarter, all from 3-point range, and Detroit erased what was a nine-point Miami lead to pull into an 81-81 tie going into the fourth. The Pistons finished the third on a 14-5 run.
The game was tied three more times in the fourth, before Ellington's 3-pointer with 6:39 left put Miami up 97-94.
Pistons: Detroit trailed at halftime for the first time in five games. ... The Pistons have dropped seven of their last nine on the road. ... Detroit is 20-16, after being 16-20 at this point a year ago. ... This is the fourth consecutive year that the Pistons have opened January on the road. ... This game started a stretch where Detroit plays six of eight on the road. After that, they've got 14 out of 18 at home.
Heat: No coach has gotten more technicals this season than Miami's Erik Spoelstra, who picked up his sixth. He's out-misbehaving the entire Heat roster; players have combined to get five. ... Olynyk and Richardson, Miami's starting forwards, opened a combined 6 of 6 from 3-point range. ... Miami has now played on 11 Wednesdays (in 12 weeks) this season. The Heat have yet to play on a Thursday.
In addition to the Drummond situation, injuries were a factor on both sides.
Bradley returned for Detroit after he missed seven games dealing with an injury in the hip and groin area. The Heat got James Johnson back after he sat out six of Miami's last seven because of bursitis in his right ankle.
Miami is still without Justise Winslow (who missed his 10th straight game with a knee strain) and Dion Waiters (who missed his fifth straight game with a re-aggravation of his oft-sprained ankle). Detroit will be without Reggie Jackson (ankle) until at least the All-Star break.
Miami was 3 for 26 from 3-point range in its previous home game, the blowout loss to Brooklyn last week. The Heat made 17 of 34 from deep on Wednesday.
Pistons: Visit Philadelphia on Friday.
Heat: Host New York on Friday.