AUBURN HILLS, Mich. -- A team clinging to slim playoff hopes can't be picky about its victories.
The Dallas Mavericks gave away a 15-point, fourth-quarter lead and blew a defensive coverage on the final possession, but still escaped with a 102-99 victory over the Detroit Pistons at The Palace on Friday.
"I just want us to focus on closing the game," Mavericks forward Vince Carter said after his team's second straight win. "It was a great job of us keeping our composure with them making a run. It's not about how pretty or how ugly they may be, just as long as we get victories."
O.J. Mayo had 22 points for Dallas, Brandan Wright scored 14 and Dirk Nowitzki chipped in 12, including two crucial late baskets. Dallas (28-33) got off to a positive start on its four-game road trip.
"That (15-point) lead kept us afloat, especially when we started missing shots and they started hitting big shots," Mavs guard Mike James said. "We've just got to learn from our mistakes. We've got to learn when we get a big lead like that, how to continue to keep moving forward instead of getting comfortable, thinking that we're fine and there's still eight or nine minutes left in the game."
Detroit had a chance to tie after Darren Collison made two free throws with 3.8 seconds remaining to give Dallas a three-point edge. Off an inbounds play, the Pistons' Charlie Villanueva got off a wide-open 3-point attempt from the left corner, but it bounced off the rim.
"That last play, we made a mistake," Mavericks coach Rick Carlisle said. "We blew that coverage, but we got lucky. If you do enough good things during the course of a game, the basketball gods sometimes are kind to you in those situations."
Nowitzki had a quiet night until he made a pair of jumpers after Detroit gained a 97-96 lead.
"I didn't get a lot of great looks but down the stretch, I got some and took them," he said. "I actually missed two after that which could have iced it, so I'm a little disappointed in that. But at least I made two to give us the lead back."
Brandon Knight's 21 points topped the Pistons (23-41), who have lost four straight and seven of their last eight. Detroit is assured of its fifth straight non-winning season.
Greg Monroe, who missed Detroit's game against New York on Wednesday with a left ankle sprain, added 14 points and 10 rebounds. Jason Maxiell (12 points, 13 rebounds) also had a double-double, and rookie Khris Middleton had a career-high 14 points.
Pistons coach Lawrence Frank missed his second consecutive game to be with his ailing wife Susan in New Jersey. Brian Hill filled in for him.
"I thought our guys took the challenge in the second half and gave us a much better effort defensively," Hill said. "We got a couple of good looks at the end but they didn't fall."
A 3-point barrage in the first 2:16 of the fourth quarter gave Dallas its biggest lead. James, a member of the Pistons' 2004 championship team, and Carter buried two apiece for the Mavs to make it 88-73.
The Pistons hung around and got the deficit down to four, 95-91, on a Middleton's 3-pointer. Villanueva's ensuing 3-pointer made it a one-point game, and Middleton gave Detroit a 97-96 lead with 2:29 left on a corner three.
"None of us are going to give up, no matter how the game is going," Middleton said. "They went on a nice little run with threes, and we answered right back."
After Nowitzki's baskets, Villanueva's putback with six seconds left got the deficit down to 100-99. But he failed to send it into overtime seconds later.
Mayo scored 14 in the first half to lift the Mavericks to a 50-42 halftime lead. Mayo made four 3-pointers as Dallas shot 52.5 percent from the field over the first two quarters.
Dallas led 76-71 after three quarters, thanks to centers Chris Kaman and Wright. They combined for 12 third-quarter points, including a Wright layup that gave Dallas its biggest advantage of the quarter, 69-59.
NOTES: Dallas forward Shawn Marion was a late scratch because of a left calf injury, prompting Carlisle to use his 20th different lineup this season. ...The Mavericks have won 10 of the last 12 meetings with the Pistons. ... The Pistons kick off a four-game West Coast swing against the Los Angeles Clippers on Sunday. Detroit plays 12 of its remaining 18 games on the road. ... Pistons guard Jose Calderon has six games of 15 or more assists this season, trailing only injured Boston guard Rajon Rondo (7). He had seven on Friday. ... Rodney Stuckey, who has played more minutes than any other Detroit reserve, was averaging 2.8 points over his previous four games. He had one point Friday. ... Dallas has made at least nine 3-pointers in the last four games. ... Detroit rookie center Andre Drummond has not begun practicing since being diagnosed with a stress fracture in his back. Drummond has missed 14 straight games.