After a very emotional loss Thursday night in Denver that crippled their playoff chances, the Dallas Mavericks hopped back on the NBA roller coaster the next day and walked away with some palatable results.

Shawn Marion collected 25 points and 12 rebounds, and the Mavs pumped up their offense over the last three quarters en route to upending the Sacramento Kings 117-108 on Friday night at Sleep Train Arena.

Unfortunately for the Mavs (37-39), their playoff chances took another huge hit as both the Los Angeles Lakers (40-36) and Utah Jazz (40-37) won their games on Friday.

Los Angeles beat Memphis 86-84, and Utah stayed a half-game behind LA with a 95-83 victory over New Orleans.

Dallas has only six games remaining in the regular season.

That means any combination of Dallas losses and Lakers victory that add up to three will officially eliminate the Mavs from the playoffs. Both LA and Utah hold the tiebreaker advantage over Dallas.

But that mattered not to the Mavs against the Kings, who they have now beaten 15 out of their last 16 matchups. Still seemingly stunned by what happened to them in Denver on Thursday when they crumbled down the stretch and lost 95-94, the Mavs trailed 27-18 after the first period.

However, they poured it on from there, scoring 41 points in the second period and adding another 33 in the third period to take a 92-81 lead into the fourth quarter.

“We were moving the ball,’’ said Shawn Marion, who finished with 25 points and 12 boards. “Everybody was looking for each other, making extra passes, and we were finding the open man.

“We kept the game simple tonight. We just did everything right and got it done.’’

The Mavs got it done because they shot 51.1 percent from the field, committed just nine turnovers and only lost the rebounding battle by a slim 45-43 margin.

“We started to get some stops,’’ coach Rick Carlisle said of his team’s offensive efficiency in the second period. “It’s very rare you’re going to hold them under 100, but we felt like if we could keep it somewhere near 100 we’d have a chance if we were having a decent shot-making night.

“Our balance was good, we shared the ball well and for us we rebounded well, so that was key.’’

Still, the sting of the loss to the Nuggets was apparent in the opening quarter when the Mavs converted just 8 of 23 shots while allowing the Kings to go 11-of-20 from the field.

“It’s always good to get a win after a tough loss,’’ said Brandan Wright, who had 20 points, six rebounds and two blocks. “We came out and played pretty hard.