The Heat trailed by 11 late in the third quarter before Miami's Mike Miller made a 3-pointer in the final seconds. The Heat then scored the first 15 points of the fourth.
"It's a 48-minute game, and we need to play all 48 minutes," LeBron James said. "We didn't do that tonight, but we took a team that was rolling and we held them to 13 points on 4-of-19 shooting in the fourth. That's big."
James had 19 points, eight rebounds and seven assists for Miami, which has won six of seven following a five-game losing streak.
Detroit had the ball down by four in the final minute, but Greg Monroe missed a layup, forcing the Pistons to foul.
"It's always frustrating when you lose a game when you think you control the game, control the tempo of the game," Monroe said. "You've got to control the game all the way to the fourth quarter and close the game out."
Richard Hamilton led Detroit with 27 points. He made back-to-back 3-pointers from the same spot in the left corner late in the third to give the Pistons a 78-70 lead. Mike Bibby appeared to answer with a 3-pointer of his own with the shot clock running out, but the Miami guard's shot ended up being disallowed between quarters.
Detroit led 81-73 after three, but went scoreless until Tracy McGrady made a shot from the top of the key with 6:25 left in the game.
"We were getting our tails handed to us and it was humbling through three quarters," Miami coach Erik Spoelstra said. "There is no easy way in this league, there really isn't."
Detroit committed two defensive 3-second violations in the first 1:13 of the fourth, and when James made a left-handed layup, the Heat had an 82-81 advantage -- their first lead since 8-7.
Rodney Stuckey fired up the crowd a bit with a one-handed dunk on a drive through the lane for Detroit, but James did him one better shortly after that, throwing down an emphatic right-handed slam off a pass from Wade to make it 94-85.
"We went through that spurt where all of a sudden we get nothing in the post when we were posting the ball," Detroit coach John Kuester said. "We weren't getting anything out of our set plays where we were getting guys coming off of screens."
In his previous game at Detroit, James made news by taking a heckler to task early in Miami's win over the Pistons. He isn't received as badly in Detroit as he is in Cleveland, but James -- who said he had family in the arena Wednesday -- says he's always prepared for a tough crowd.
"There's drama here, too," he said. "There is drama at every road game I play. They are used to it."
Bibby made his first start for Miami in his 11th game with the team, scoring five points. The Heat are without guard Mario Chalmers (sprained right knee) and center Zydrunas Ilgauskas (right foot infection).
Miami moved within 1½ games of Boston for the No. 2 spot in the Eastern Conference.
"It was a good win for us on the road tonight," Wade said. "We want to continue to play well and tonight I think that we found a way to win."
Detroit's Ben Wallace missed the game because of a sore left knee. Wilcox started at center for the Pistons in the team's 20th different starting lineup of the season. ... Bosh went 11 of 12 on free throws, his fifth straight game with at least 10 attempts from the line. ... Miami improved to 13-0 when James, Wade and Bosh each shoot at least 50 percent from the field. James went 8 of 16, Wade was 7 of 13 and Bosh finished 6 of 11. ... Detroit owner Karen Davidson said at halftime she had no comment on the status of the team's sale.
NEXT-LEVEL: The Big 3 did most of their damage around the basket on Wednesday, as 17 of their 21 made field goals were within 5 feet of the hoop. From outside 5 feet, the Big 3 combined to shoot just 4-of-18.
NEXT-LEVEL: The Heat ended the third quarter trailing by eight points, but their defense in the fourth quarter allowed them to make a run and get back in the game. The Heat began the fourth quarter on a 13-0 run, and held Detroit scoreless the first 5:40, taking an 88-83 lead that they never surrendered.