DALLAS (AP) -- O.J. Mayo and the Dallas Mavericks were embarrassed by a blowout loss in Houston. Given a chance to atone for it three nights later, they made the most of the opportunity.
Mayo had two big fourth-quarter baskets and a career-high 12 assists, Dirk Nowitzki scored 22 points and the Mavericks hung on to win the quick rematch with the Rockets 112-108 on Wednesday night.
Dallas' humiliating final quarter of garbage time in Houston's 33-point win Sunday was replaced by 12 tense minutes that included two chances for James Harden to tie or give the Rockets the lead in the final 30 seconds.
Harden, who led Houston with 28 points and made all 16 of his free throws, missed a 3-pointer and a layup against the tight defense ofShawn Marion, who matched Nowitzki with 22 points.
''After what happened in Houston, it was embarrassing, as a man, as a player and as a Dallas Maverick,'' said Mayo, who had 13 points and six rebounds without a turnover. ''We really wanted to come in here and show our fans that we are a much better squad.''
Harden, who also had nine assists, put the Rockets ahead 104-102 with a 3-pointer with 3:41 remaining, but Mayo answered with a 3 and another jumper to put Dallas up for good at 107-104. Mayo's last assist came on a bucket by Nowitzki that pushed the lead to 109-104.
The Rockets got within one after Harden twice was fouled driving for a layup and hit all four free throws. The Mavericks had to settle for a two-point lead when Marion missed one of two free throws, but their defensive stopper made up for it at the other end.
Officials had to use replay to confirm possession on an out-of-bounds call after both misses by Harden, who was 5 of 17 from the field. The first call in favor of the Rockets was confirmed, giving Harden a second chance. But the second ruling went Dallas' way with 6.4 seconds left, and Darren Collison hit two free throws for the final margin.
''I'm just trying to make it hard for him,'' Marion said. ''Crowd him and don't let him get comfortable. He's a very aggressive player. At the same time, you take a lot of free throws out of the game and he had a rough night.''
Chandler Parsons had 23 points for Houston after scoring a career-high 32 on Sunday, while Jeremy Lin scored 12 but sat the entire fourth quarter in favor of backup Patrick Beverley.
''We were prepared for a dogfight and we knew they were going to play extremely hard given the circumstances of what just happened,'' Parsons said. ''I thought we put ourselves in a position to win. It's one that we let slip away.''
Nowitzki was called for his fifth foul and a technical midway through the fourth quarter after a rough sequence that ended with the 7-footer getting his shot blocked by the 6-foot-1 Beverley. Nowitzki knocked Carlos Delfino to the floor as he was trying to start a fast break.
Rockets coach Kevin McHale looked primed for a technical a few minutes earlier when Beverley was called for an offensive foul after he ran into Vince Carter while Carter was pursuing Thomas Robinson, whose dunk was waved off.
''There was a lot going on out there,'' Dallas coach Rick Carlisle said. ''We weathered everything tonight, and it is a sign of character.''
After getting outscored by Houston 44-17 in the third quarter Sunday, the Mavericks pushed a four-point halftime lead to 13 before letting the Rockets get within 84-83 on a 15-3 spurt late in the third. Carter restored Dallas' four-point lead with a 3-pointer with 14 seconds left.
Lin hit a 3-pointer at the first-half buzzer, but officials overturned a ruling that the basket was good after a lengthy video review. The change gave Dallas a 60-56 halftime lead.
Lin's shot came at the end of a sequence that illustrated the brisk pace of the first half. After a Houston miss, Carter rushed up the floor with 7 seconds left, but Marion's layup was blocked by Parsons. The Rockets managed to get Lin an open shot at the 3-point line in less than 4 seconds.
The Mavericks were shooting nearly 70 percent in the middle of the second quarter, but only led by four because the Rockets made six straight shots, four of them coming in a stretch of six combined baskets between the teams in just 1:23.
Houston's hot streak included three quick 3-pointers that erased most of a 41-31 Dallas lead, the biggest of the first half for the Mavericks. Delfino had two of them.
Nowitzki had eight points in the first quarter after finishing Sunday's blowout loss with that total. Marion had 12 in the first for Dallas, and the pair combined to go 9 of 12 from the field. Mayo had five assists in the first six minutes, and four of them led to layups and one dunk for Marion.
NOTES: G Mike James made his first start for Dallas. He was picked up as a free agent and played on a pair of 10-day contracts before getting a guaranteed deal for the rest of the season. It was James' first start since March 25, 2009, with Washington. ... Harden became the third Rockets player with at least 500 free throws in a season. He's on pace to break Moses Malone's franchise record of 630 from 1981-82. ... Mavericks C Elton Brand had a first-quarter block to pass McHale on the career list. They were tied for 24th at 1,690 blocks when the game started. ... Parsons has the longest 20-point streak of his career at five straight games.