There was no way the Rockets would break through easily. They could build leads and run through most of the fourth quarter impressively. But if their recent history in Dallas had proved anything, it was that somehow, some way the game would come down to the final seconds, likely the last shot.

It did. The Rockets had to blow all but the final two points of a 12-point lead in the last three minutes. They had to foul inexplicable and turn the ball over on their final possession. But after all the times in Dallas they nearly won and somehow lost, they had done enough to nearly lose before coming away with a 117-115 win, snapping a seven-game losing streak in Dallas and giving them wins against their Texas rivals on consecutive nights for the first time since 1989.

“It’s an in-state rivalry,” guard Aaron Brooks said. “I don’t want to say it’s that drastic that as long as you win that matchup against the Dallas Mavericks and the San Antonio Spurs it’s enough, but if you do, you’re going to have a good season. It’s a good feeling.”

They didn’t get the win until Jose Calderon missed a pair of 3s in the final seconds, but they got it, repeatedly building double-digit leads until the last one was just enough.

“It’s huge for us,” said Parsons, who led the Rockets with 26 points. “For me personally, I never won here. They’re a team that is a big rival in-state. We knew they were not going to give up. We made some real stupid decisions and plays down the stretch and really got fortunate to win this game.”

As always in Dallas, the Rockets made things excruciatingly difficult for themselves. Leading by 12 with 2:53 left after a strong Lin drive had seemed to seal it, the Rockets twice fouled 3-point shooters, with Pat Beverley and Donatas Motiejunas sending Vince Carter and Devin Harris to the line. They made all six free throws. Dirk Nowitzki hit another 3, cutting the lead to four with 1:10 left.

After Lin and Parsons missed, Dwight Howard fouled Nowitzki under the Rockets basket and Nowitzki pulled the Mavericks to within two with 22.2 seconds remaining.

“If we don’t do that, we’re perfectly fine,” Rockets coach Kevin McHale said of the Rockets fouls in the final three minutes, allowing the Mavericks to score eight points with the clock stopped. “Make them use the clock. Then we had some turnovers. We had two or three chances to blow the game wide open. All that being said, it was a hell of a win for us. We found a way to win.