Dallas trailed by 16 points midway through the third period, but came back to win its third in a row and remain unbeaten in six home games. Houston had won its previous three contests.
The Mavericks were still behind by seven with 3:46 to play, but outscored the Rockets the rest of the way 14-4.
Marion's clutch 3-pointer gave Dallas a 121-119 lead and Houston climbed within one when James Harden hit 1-of-2 foul shots with nine seconds remaining.
Jose Calderson then hit a pair for the Mavericks with six seconds to go and Harden was unable to connect on a 3-point attempt two seconds later.
Ellis had 37 points and eight assists while Nowitzki grabbed seven rebounds to go with his 35 points.
Dallas outshot Houston 58 percent to 55. The Rockets had 40 points in the first period, but the Mavericks won the fourth quarter 36-19.
Dwight Howard led Houston with 33 points and Harden had 23.
Celebrity Families of 2014 [PHOTOS]