Behind a strong finishing kick, the Dallas Mavericks rebounded from their worst loss of the season.
The stumbling Detroit Pistons, on the other hand, are still searching for a way to end their longest losing streak in more than 15 years.
The Mavericks were coming off a 131-96 loss Sunday to the Los Angeles Lakers, their most lopsided setback of the season and a performance coach Rick Carlisle called "embarrassing."
There seemed to be a carry-over from the Lakers game early against Detroit. Dallas shot 29 percent in the opening quarter and trailed by 14 in the first half on Tuesday.
Nowitzki and Terry combined to score 31 points in the second half to lead the rally against the Pistons.
"It was ugly," said Nowitzki who also grabbed 12 rebounds and finished 9 of 20 shooting. "It looked like we had a little West Coast hangover. We didn't have any energy. But (Terry) carried us offensively all game long. He kept making shots."
The Pistons led for the better part of the first three quarters as they looked to win for the first time since Dec. 12. Rodney Stuckey missed a 3-pointer with 7.9 seconds left that could have tied the game.
Detroit hasn't dropped 10 in a row since the end of the 1993-94 season. The Pistons lost their final 13 games that season to finish 20-62.
The Pistons will try to end their slide Wednesday night at San Antonio.
"Our guys competed," Pistons coach John Kuester said. "I was very impressed. We're going through an interesting stretch. But we're going to find a way to get out of this hole."
Detroit's Richard Hamilton scored 20 points, Charlie Villanueva had 17 and Stuckey had 10 of his 15 points in the fourth quarter.
The Pistons are still trying to regroup from a rash of injuries.
Hamilton (hamstring and ankle) and Tayshaun Prince (ruptured disc in back) have both missed 26 games, and Ben Gordon (left ankle) was out for nine in a row in December. All three returned to the lineup Dec. 27.
"We've had our ups and downs this whole year," Stuckey said. "We've had a lot of injuries. But that's not going to let us get down on each other."
Drew Gooden had 10 points and a season-high 18 rebounds, including a career-best nine on the offensive end. Shawn Marion added 18 points.
Gooden's struggles mirrored Dallas' early woes. He airballed two short jumpers in the first three minutes and missed 12 of his first 14 shots, several of which were tip attempts on the offensive glass.
"He kept tipping it to himself," Nowitzki said of Gooden. "There seemed to be a lid on the basket. But he's a warrior in the paint."
The game was tied at 68 after three quarters when the Mavericks opened the fourth with an 11-3 run. Terry and Gooden each had four points in the run that put Dallas up 79-71 with 8:34 left.
The Mavericks still led 94-86 on Terry's jumper with 1:45 left before the Pistons rallied. Gordon connected on a jumper that cut Dallas' lead to 94-93 with 14.7 seconds remaining in the game.
Nowitzki hit a pair of free throws with 10.4 seconds left to stretch the advantage to 96-93.
Stuckey missed an open 3-pointer from the baseline that could have tied it, and Marion clinched the game with a pair of free throws with 6.5 seconds left.
The Mavericks improved to 10-3 in games decided by five points or fewer.
"Early on, we were missing bunnies at the basket," Terry said. The third quarter came and we pushed the tempo. That is the way we like to play."
Dallas was 6 of 21 from the floor -- including seven misses in a row at one point -- in the first quarter and trailed 22-14.
Led by 12 first-half points each from Villanueva and Prince, Detroit's lead increased to 40-26 midway through the second quarter.
Nowitzki scored 14 points on 6 of 8 shooting in the third as the Mavericks rallied to tie the game heading into the final quarter.
NOTES: Nowitzki played in his 873rd career game with Dallas, moving past Derek Harper into second place on the club's career list. He is 11 away from passing Brad Davis for most games played in team history. Pistons backup G Will Bynum (ankle) missed his third consecutive game. ... Mavericks C Erick Dampier (left knee) was out of the lineup for the second game in a row.