Updated

Orlando, FL (SportsNetwork.com) - Isaiah Thomas and Rudy Gay each scored 23 points to help the Sacramento Kings salvage the final test of their four-game road trip with a 105-100 win over the Orlando Magic.

Marcus Thornton netted 15 points off the bench on 3-of-6 shooting from beyond the arc and DeMarcus Cousins contributed a double-double with 14 points and 11 rebounds in the win, Sacramento's third straight against Orlando.

Arron Afflalo led all scorers with 26 points in his return to the lineup after missing Wednesday's loss to Utah with a stomach ailment.

Tobias Harris had 21 points, while Jameer Nelson and Victor Oladipo added 13 and 12, respectively, for Orlando, which has lost four straight games at Amway Center.

When speaking of Thomas, Magic head coach Jacque Vaughn said, "He's a nuisance. He can get in the lane, make shots, and I think he really enjoys competing."

Orlando led 58-56 at the half, but five players scored for Sacramento during a 10-2 spurt to open the third quarter.

Glen Davis then scored two straight buckets for Orlando which ignited an 11-2 run. A Nikola Vucevic layup with 4:53 to play in the frame capped the spurt and gave the Magic a slim 71-68 lead.

The Kings responded when Gay hooked up with Cousins for an alley-oop that was the first bucket of seven straight points for the Kings.

Oladipo helped Orlando return serve with five points during a 6-0 run to end the quarter to retain its two-point advantage into the fourth.

Sacramento gained control of the contest with an 18-4 run in the opening 2:49 of the fourth. Thornton had 11 points during the surge, including three straight 3-pointers to cap the run and help the visitors to a 93-81 lead.

Later, Vucevic fouled out with 2:37 to play after he hacked Cousins during a made layup. Cousins missed the free throw and Sacramento led 100-93.

Orlando pulled within four, 101-97, following four straight points from Harris with 1:30 to play.

Just under a minute later, Thomas dribbled in from the far wing and banked in a 15-foot jumper to increase the lead to six.

Orlando called a timeout but turned the ball over, essentially ending the game on a five second call when Davis couldn't get the ball in bounds.

"We made enough plays obviously to get that win," said Kings head coach Michael Malone. "(I'm) proud of our guys to finish up a disappointing road trip but we didn't hang our heads."

Game Notes

Thomas also had nine assists ... Each team's largest lead was 12 and both scored 34 points in the paint ... The Kings shot 12-for-23 (52.2 percent) from deep ... Vucevic finished with four points and nine rebounds ... Both teams are home on Monday as Orlando will host New York and Sacramento welcomes New Orleans.