PHOENIX (Ticker) -- Dirk Nowitzki and Jason Terry helped the Dallas Mavericks gain a small measure of revenge against the Phoenix Suns.

Nowitzki scored 28 points and Jason Terry added 23 as the Mavericks rallied from a 17-point deficit in the fourth quarter before posting a thrilling 111-108 double-overtime victory over the Suns.

Dallas' season came to an end in 2004-05 here, as it was defeated by Phoenix in the Western Conference semifinals. The Suns appeared to be in position for an easy win Tuesday after Shawn Marion's layup made it 83-66 with 7:43 left in the fourth quarter. However, Keith Van Horn made a pair of free throws and a 3-pointer to ignite 24-7 run.

Darrell Armstrong converted a layup and Marion and Van Horn traded free throws before Nowitzki took over, hitting three straight 3-pointers and assisting on Terry's layup that gave the Mavericks an 87-86 edge with 1:21 to go.

After Marion put the Suns back in front on the other end, Terry made another basket and a free throw before reigning MVP Steve Nash hit a pair from the line with four seconds remaining to forge a 90-90 tie and send the game to overtime.

Phoenix again gained control in the first overtime, taking a 101-96 lead on Boris Diaw's layup with 36 seconds on the clock. But Terry found Marquis Daniels for a 3-pointer seven seconds later and nailed a runner at the buzzer to force another extra session.

Nowitzki gave Dallas the lead for good with a jumper 50 seconds into the second OT and assisted on Van Horn's shot from the arc that pushed the edge to 106-101 with 3:38 left.

Phoenix cut the deficit to 110-108 on Leandro Barbosa's basket one minute later but missed a pair of potential game-tying jumpers over the next 90 seconds. The Suns had one last chance after Van Horn made 1-of-2 free throws with 23 seconds to go, but Nash's desperation 3-pointer at the buzzer bounced off the rim.

Nash had 30 points, nine assists and eight rebounds for the Suns, who were playing without All-Star Amare Stoudemire. The NBA's third-leading scorer last season, Stoudemire is recovering from offseason knee surgery and will miss at least three months.