Slovenian rookie Doncic started slowly but caught fire late in the fourth, scoring 11 consecutive points to erase an eight-point Houston lead as the Mavericks recorded their ninth straight win at home.
Doncic, 19, made a floater to tie the contest 102-102 late in the fourth after Chris Paul had missed two free throws.
Harden then put up an air ball from beyond the arc and Doncic made the Rockets pay for their mistakes by draining a three-pointer to give Dallas a three point lead, 105-102.
Eric Gordon then missed a potential tying three-pointer for Houston at the buzzer.
Harden, who overcame early foul trouble, led all scorers while Paul finished with 23 points and eight assists. However, the Rockets couldn't hold the lead less than two weeks after losing to Dallas by 20 points at home.
The Mavericks extended their longest home winning streak since winning nine straight in 2011, the year they won their only NBA championship.
Doncic finished seven of 17 from the field with seven rebounds. DeAndre Jordan finished with 12 points and 20 rebounds.