Last month, the Kings appeared on their way to a win over Indiana when an improbable four-point play by the Pacers forced overtime and eventually led to a loss.

The Kings appeared on the verge of yet another late-game breakdown that would result in defeat Wednesday night against the Toronto Raptors at Sleep Train Arena.

The Kings held on for a 109-101 win, but it wasn’t easy, considering they once led by 22 points.

“We make it interesting,” Kings coach Michael Malone said.

The Kings led 105-98 with 28.5 seconds to play when guard Ben McLemore was called for a foul before Toronto inbounded. Steve Novak’s free throw made it 105-99.

Then the Raptors’ Kyle Lowry made what appeared to be a three-pointer, and the officials’ whistle blew as the ball went through the hoop. It appeared Lowry would have a free throw to cut the Kings’ lead to two, but instead of McLemore being called for a foul, Lowry was called for an offensive foul for kicking his leg out as he shot. It was Lowry’s sixth personal foul, and he picked up his second technical foul of the game after the call.

Either way, Lowry was done for the night.

“At first I thought they called the foul on Ben,” Malone said. “Then it was going to be another four-point play and déjà vu all over again. Obviously, they called the leg kick, so there was a little sigh of relief.”

Had the call gone the other way, the Kings (17-32) might have found themselves explaining how they’d fallen apart in the fourth quarter. Instead, they won their second game in a row before a four-game trip that will take them into the All-Star break.

“I thought I had a great contest,” McLemore said. “I knew I didn’t foul him and I fell pretty hard and I knew I didn’t just fall on my own. I looked up, and the ref was calling the offensive foul.”

The Kings were in control most of the game until the Raptors made a push in the fourth quarter, outscoring them 29-17.

Sacramento had four starters score in double figures, led by DeMarcus Cousins with 25 points to go with 10 rebounds. Rudy Gay had 24 points and 10 rebounds in his first game against the Raptors since the December trade that brought him to Sacramento from Toronto. Isaiah Thomas had 23 points and five assists.