DALLAS -- Rick Carlisle was watching the game in his office before halftime, Dirk Nowitzki was beat up after getting hit in the face and the Dallas Mavericks seemed on the verge of getting blown out by the lowly Minnesota Timberwolves on their home court.

Then the Mavericks toughened up their defense and what seemed like an insurmountable margin was erased in less than one half.

Jason Terry scored 24 of his 29 points in the second half, and Dallas rallied from a 29-point deficit to beat the Timberwolves 107-100 on Tuesday night.

"The first half was ugly," said Nowitzki, who had a bloody nose after being hit by Craig Smith on a drive to the basket in the third quarter. "They got whatever they wanted because our defense was soft. It took a lot of defensive energy to come back."

The Timberwolves led 70-41 early in the third quarter when the Mavericks started their comeback, the largest in franchise history.

Dallas' first big push was a 22-2 run to get to 72-63. Terry scored 12 points as the Mavericks opened the fourth period outscoring the Timberwolves 22-7.

"We dug ourselves a hole and we just kept on fighting," Terry said. "It was the type of effort where we said we were going to run it out with six or seven guys and leave it all out there on the court."

Minnesota's Al Jefferson had a three-point play to tie the game at 98 with 2:35 left. But Nowitzki, who scored 24 points, tipped in his own miss to give Dallas a 100-98 lead with 2:15 to go. Josh Howard hit a 3-pointer and Nowitzki punctuated the comeback with a layup that gave Dallas a 105-98 advantage.

"Everybody wanted to play and that is something that you need when you are down," Jason Kidd said. "Josh made some big shots and Dirk played great. We got it from everybody."

Jefferson scored 21 points, Ryan Gomes added 19 and Randy Foye had 18 for the Timberwolves, who blew the largest lead in franchise history.

The Timberwolves made just 14 of 38 shots and turned the ball over nine times after halftime after shooting 61 percent in the first half.

Minnesota, which snapped a 13-game skid Friday, has lost 15 of 17. The Timberwolves have dropped 10 straight to the Mavericks.

"I've never really experienced anything like that," Foye said. "It seemed like they made their run in the second half and they just kept on coming. They wouldn't stop. We would make a little run, but they just kept on coming."

Howard scored 23 and Kidd had 14 points and a season-high 16 assists for Dallas.

The Mavericks, who saw Carlisle get ejected in the second quarter, outscored the Timberwolves 66-30 in the final 22:26.

"It was our game. It was in our hands," Foye said.

Minnesota led by 22 at halftime and outscored Dallas 8-1 in the first 1:34 of the third quarter.

Nowitzki, who was playing his first game since serving a one-game suspension, started the rally with a dunk. He hit a free throw to cap a 22-2 spurt that brought the Mavericks to 72-63.

Minnesota still led 84-73 after three quarters before Terry scored 12 straight points, the last of those coming on a jumper that cut the Timberwolves' lead to 91-89.

Kidd tied it with a jumper, and the Mavericks took their first lead on Nowitzki's dunk at 93-91 with 5:26 left.

Dallas' previous largest comeback was 25 points against Denver on Nov. 26, 1994.

"Coaches at halftime said we need to turn it up," Terry said. "Defensively was where it started. That's when we started building confidence."

The Timberwolves led 27-20 after the first quarter and quickly built their lead into double digits.

Brian Cardinal stripped Nowitzki while he was driving for a layup, and Rodney Carney scored on a breakaway dunk to give the Timberwolves a 46-30 cushion with 6:30 left in the opening half.

Carlisle argued the non-call on Nowitzki and was given two quick technicals by official Gary Zielinski. It was Carlisle's first ejection with Dallas, and assistant Dwane Casey -- who once coached the Timberwolves -- ran the team for the remainder of the game.

Jefferson hit two free throws to extend Minnesota's lead to 60-35. That capped a 20-5 run.

The Timberwolves outscored the Mavericks 35-20 in the second quarter.

Game notes

Minnesota G Mike Miller (sprained right ankle) missed his fifth straight game. ... Mavericks G Jose Barea left with a left shoulder strain and did not return. ... Football players from Mississippi and Texas Tech were in attendance. The Rebels and Red Raiders are in town to play in the Cotton Bowl on Friday.