Cory Joseph made a 14-foot jumper with 25.9 seconds remaining to cap a game-ending 11-0 run that rallied the Detroit Pistons past the Sacramento Kings 133-131 on Wednesday night.

Saddiq Bey had 30 points and seven rebounds to help the Pistons (11-33) win their fourth in seven games. Kelly Olynyk added a season-high 22 points and nine rebounds.

Joseph, the former Kings guard who was dealt to the Pistons at the trade deadline last year, finished with 19 points and nine assists.

Detroit Pistons guard Cade Cunningham (2) drives past Sacramento Kings guard De'Aaron Fox (5) during the first quarter of an NBA basketball game in Sacramento, Calif., Wednesday, Jan. 19, 2022. (AP PhotoJosé Luis Villegas)

Detroit Pistons guard Cade Cunningham (2) drives past Sacramento Kings guard De'Aaron Fox (5) during the first quarter of an NBA basketball game in Sacramento, Calif., Wednesday, Jan. 19, 2022. (AP PhotoJosé Luis Villegas)

Terence Davis scored 14 of his career-high 35 points in the fourth quarter for the Kings. De’Aaron Fox added 27 points, eight assists and six rebounds but missed a 14-footer that bounced off the front of the rim at the buzzer.

Sacramento has dropped seven of nine.

The Kings led 131-122 with 2:34 left but went scoreless the rest of the way while the Pistons seized control.

Sacramento Kings guard De'Aaron Fox (5) is fouled by Detroit Pistons guard Cade Cunningham (2) on a shot during the first quarter of an NBA basketball game in Sacramento, Calif., Wednesday, Jan. 19, 2022. (AP PhotoJosé Luis Villegas)

Sacramento Kings guard De'Aaron Fox (5) is fouled by Detroit Pistons guard Cade Cunningham (2) on a shot during the first quarter of an NBA basketball game in Sacramento, Calif., Wednesday, Jan. 19, 2022. (AP PhotoJosé Luis Villegas)

Bey and Olynyk made consecutive 3-pointers, and Bey followed with a three-point play to tie it at 131. After Fox missed a short jumper, Joseph connected on the go-ahead shot to silence the crowd.

The Pistons led by seven at the end of the first quarter and were up 39-34 after Olynyk blocked a shot by Davion Mitchell, then sprinted to the other end and dunked off an offensive rebound.

Davis, starting while Tyrese Haliburton remains in health and safety protocols, got the Kings going. Davis scored 16 of Sacramento’s season-high 45 points in the second quarter, connecting on six of eight shots — including a pair of 3s.

Sacramento Kings forward Harrison Barnes (40) is defended by Detroit Pistons forward Trey Lyles (8) during the first quarter of an NBA basketball game in Sacramento, Calif., Wednesday, Jan. 19, 2022. (AP PhotoJosé Luis Villegas)

Sacramento Kings forward Harrison Barnes (40) is defended by Detroit Pistons forward Trey Lyles (8) during the first quarter of an NBA basketball game in Sacramento, Calif., Wednesday, Jan. 19, 2022. (AP PhotoJosé Luis Villegas)

After trailing 93-82, the Pistons scored 12 straight points in the third.

TIP-INS

Pistons: Bey had 17 points in the first half. … Hamidou Diallo was charged with a technical in the second quarter. … Jerami Grant has entered the NBA’s health and safety protocols. … Killian Hayes (bruised right hip) was held out.

Detroit Pistons center Isaiah Stewart (28) pulls down an offensive rebound between teammate Cory Joseph (18) and Sacramento Kings center Richaun Holmes (22) during the first quarter of an NBA basketball game in Sacramento, Calif., Wednesday, Jan. 19, 2022. (AP PhotoJosé Luis Villegas)

Detroit Pistons center Isaiah Stewart (28) pulls down an offensive rebound between teammate Cory Joseph (18) and Sacramento Kings center Richaun Holmes (22) during the first quarter of an NBA basketball game in Sacramento, Calif., Wednesday, Jan. 19, 2022. (AP PhotoJosé Luis Villegas)

Kings: Fox and Chimezie Metu were called for technicals in the first half.

UP NEXT

Pistons: Face the Jazz in Utah on Friday. Detroit beat Utah on Jan. 10 to end a four-game skid against the Jazz.

Kings: Begin a five-game road trip against the Bucks on Saturday. Milwaukee has won 10 straight against Sacramento dating to 2016.

More AP NBA: https://apnews.com/tag/NBA and https://twitter.com/AP_Sports