For three periods Tuesday night at Barclays Center, it seemed the Nets were headed for their eighth straight loss against the same Los Angeles Clippers team that started their downward spiral with a 27-point blowout on Nov. 14 in Los Angeles.

But Sean Kilpatrick drew a line in the sand with a magical 20-point fourth quarter in which he sparked an improbable 29-10 run to bring the Nets from 16 points behind, and then he clinched a stirring 127-122 victory in double overtime with a three-point play with 13.5 seconds left that gave him 38 points. It was the third straight loss for the Clippers (14-5) and a much-needed shot of hope for the injury-plagued Nets (5-12).

“We went to L.A., and they got us bad,” Kilpatrick said of the Clippers. “That stuck in our minds . . . It’s huge for us to win a game like that in double-OT. For us to sit here and gut it out like that is huge.”

Coach Kenny Atkinson said the win reflected the “character” and “resilience” of a team that has struggled without injured starters Jeremy Lin and Rondae Hollis-Jefferson. As for Kilpatrick’s amazing 31-point outburst in the fourth quarter and two overtime periods, Atkinson shook his head and said, “Sean, I think, was 2-for-10, and I’m sitting over there saying, ‘ Wow, he is really struggling. Do we get him out or what?’

“Sean kept at it and kept competing, got a few shots to fall and he started rolling. He did a great job.”

The Nets trailed 89-73 early in the fourth quarter before Kilpatrick hit a three-pointer to begin the 29-10 run that ended with a three by Brook Lopez for a 102-99 Nets lead with 3:02 remaining.

advertisement | advertise on newsday

Another Lopez three from the top of the arc gave the Nets a 107-104 lead with 1:11 to play. The Clippers’ Chris Paul, who had a triple-double with 26 points, 10 rebounds and 13 assists, ruined the fairy-tale finish with a corner three with 1.8 seconds left to tie the game.

The first overtime was just as frantic. The Clippers pulled within two with 19.9 seconds left at 117-115 when DeAndre Jordan made one of two foul shots. Moments later, Kilpatrick was fouled under the basket, and a technical also was called on Clippers coach Doc Rivers by referee Kevin Scott, who thought he was yelling at referee Lauren Holtkamp. Rivers had to be restrained from making contact with referee Ken Mauer, who ejected him.

The Nets had a chance to close the game with 18.6 seconds left. But Isaiah Whitehead missed both technicals, and Kilpatrick made one of his two free throws for a 118-115 lead. With 10 seconds left, a crosscourt Paul pass found Jamal Crawford wide-open for the tying three that sent it to double-OT.

The Nets took a 124-122 lead on a Whitehead layup with 47.1 seconds left. Paul missed a jumper, and Kilpatrick found something in reserve for a driving layup past Jordan that turned into a clinching three-point play for a 127-122 lead with 13.5 seconds left.

“DeAndre Jordan was off-balance,” Kilpatrick said. “He bit on a crossover, and I knew I had him. I got to the rim quick.”

Brooklyn Nets videos

Kilpatrick had 14 rebounds to go with his 38 points, Lopez scored 27 points and had eight rebounds, and Trevor Booker had 15 points,11 rebounds, five assists and four steals. The Clippers rested healthy All-Star forward Blake Griffin, but Jordan totaled 21 points and 23 rebounds.

Afterward, Rivers was more upset with his team than the referees. “We lost our discipline defensively,” Rivers said. “We were walking around like we had done something against a team that, to me, is playing their hearts out every night just to win one game. That bothers me.”