BOSTON, Jan. 9 (Ticker) -- With his team in the middle of a grueling stretch, Jerry Stackhouse helped the Dallas Mavericks avoid any extra work against the Boston Celtics.

Stackhouse scored 20 points, including the go-ahead basket with one-tenth of a second remaining as the Mavericks posted a 104-102 victory over the slumping Boston Celtics, who dropped their third straight.

NBA TV highlights from
Mavericks-Celtics:
Play
Jason Terry added 30 points for Dallas, which improved to 4-1 in a stretch in which it plays six times in nine days.

A 6-6 swingman, Stackhouse had his best game of the year, making 7-of-13 shots from the field and all five free throws off the bench. Overall, the Mavs got 40 points from their reserves.

Boston trailed, 102-99, with six seconds remaining when Paul Pierce nailed a 3-pointer to tie the game.

"We were up three and we should never give up a (3-pointer)," said Dallas forward Dirk Nowitzki, who scored 11 of his 26 points in the fourth quarter. "That was my fault. We were switching and Paul made a good play and got me in the air and made the three."

However, Dallas ran down the clock before getting the ball to Stackhouse, who drained a jumper from the right baseline over the outstretched hand of Ricky Davis.

"I was able to make sure we got the last shot and I rose up and hit it," Stackhouse said. "I had a couple before that I thought were going down, but I'm glad I got the one that counted."

"I was there, guy just made a great shot," said Davis, who scored 17 points. "I put pressure on him a little bit. He drove right and made a great pull-up."

Dallas held an 88-84 lead with seven minutes left before Nowitzki and Terry each hit shots from the arc to fuel a 10-3 burst that pushed the edge to 98-87.

However, the Celtics responded with a 12-2 spurt to draw within 100-99 with 1:35 left. Nowitzki then hit a jumper to set the stage for the final sequence.

"Basketball is a game of runs," said Terry, who made 7-of-13 3-pointers. "They went on a good run on us, we came back with a run and they ended it off good with a run.

"But like I said all year long we have been involved with close games so we do not get nervous or paranoid at the end. We stick together, we've been here before."

Reserves Keith Van Horn scored 12 points and DeSagana Diop added seven rebounds and five steals for Dallas, which shot 54 percent (12-of-22) from the arc and collected seven blocked shots.

"We are a deep team and we rely on our depth a lot," Terry said.

Pierce had 32 points and eight rebounds and Tony Allen added 12 for the Celtics, who were coming of Saturday's 103-102 setback at Washington.

"Things are going to turn around, two heartbreaking games we had," Pierce said. "Hopefully we can just learn from these types of games as the season goes along."