DALLAS -- The second time proved the charm for Deron Williams.
Instead of giving the Dallas Mavericks a victory at the end of regulation Tuesday night, the veteran point guard did so at the end of the second overtime.
Williams' 3-pointer from the corner at the buzzer finished off an improbable 8-0 run that lifted the Mavs past the Sacramento Kings 117-116 at American Airlines Center.
"We needed this one in a bad way," Williams said.
The Mavericks (20-15) snapped a two-game losing streak and beat the Kings for the 22nd consecutive time in Dallas.
Sacramento (14-21) had won its two previous games, including the franchise's first-ever victory in Oklahoma City on Monday night.
"This road trip I think we'll remember that we're coming together in a good way, but just disappointed not to have two wins instead of one," Kings coach George Karl said. "The only thing I can complain about is the outcome of the game."
The Kings, despite being down two starters and down as many as 10 points in the second half, were in position to pull off another stunner when they led 116-109 with 1:20 left in the second OT.
Power forward Dirk Nowitzki's 3-pointer pulled Dallas within two points with 26 seconds left. Kings guard Darren Collison shot an air ball, setting up a final possession for the Mavs with 2.3 seconds left.
Williams (25 points) took a sideline inbounds pass in the corner and used one pump fake on Kings small forward Rudy Gay before draining the game-winner at the buzzer. He also hit a finger roll with 2.1 seconds left in regulation that gave Dallas a 98-96 edge.
"I found myself open, Gay flying at me, just pump faked and I let it go," said Williams, back in the starting lineup after coming off the bench for two games to nurse a hamstring injury.
The Kings were carried by center DeMarcus Cousins and Gay, as point guard Rajon Rondo and small forward Omri Casspi sat out with injuries.
Cousins scored Sacramento's first nine points in the second extra session, and finished with 35 points and 17 rebounds. He added six steals and four assists, and sent the game into the first overtime with a driving layup.
"It was an incredible game," Cousins said. "Both teams left it on the floor. We don't want to make any excuses. Of course we are shorthanded, but we had plenty of opportunities to win the game tonight.
"Big shots from them, big shots from us, it was just whoever made the biggest shot. It was a good game, it was a fun game."
Gay scored 31 on 13-of-20 shooting. His 3-pointer gave Sacramento a 116-109 lead late in the second OT.
"When you're down seven with 1:20 to go, you have to pitch a perfect game," Dallas coach Rick Carlisle said. "The odds are 1-in-100 that you can actually do it, but you've got to have belief."
Dallas fans were anticipating the return of Rondo, but the league's assist leader was out with a bad back. The back began giving him problems against Oklahoma City and worsened Tuesday morning.
Rondo and the Mavs were a bad fit last season after an early-season trade from Boston, and he left the team during the first round of the playoffs.
Mavs small forward Chandler Parsons exited the game with a right hip injury.
The Mavericks finish off a back-to-back Wednesday night at New Orleans. Sacramento returns home Thursday to play host to the Los Angeles Lakers.
NOTES: Cousins passed Chris Webber has the all-time rebound leader in the Sacramento era of franchise's history. ... The Kings were without F Omri Casspi (back) and C Willie Cauley-Stein (finger). G Ben McLemore (back) was active. ... Dallas G Deron Williams (hamstring) was active after missing the fourth quarter of Saturday's loss to New Orleans. G Devin Harris (back) was also active. ... The Kings won the previous matchup with Dallas 112-98 in Sacramento on Nov. 30.