INDIANAPOLIS — Kasey Kahne earned a career-defining victory as the sun set at Indianapolis Motor Speedway.

That was appropriate, because the sun could end up setting on his NASCAR career over the next six months. An 18-time winner in the Cup Series, his future is literally in the dark at Hendrick Motorsports, where he has a contract through next year but so far little sponsorship to guarantee a ride.

Just 10 hours after his team owner Rick Hendrick declined to talk about Kahne’s future, Kahne at least knows his 2017 could be considered a somewhat successful one as the win launches him from 22nd in the standings and into the 16-driver playoffs.

“It feels good to win, you know?” Kahne said. “For all these people that work so hard, it feels good to get into Victory Lane and show that we can do it if things go our way.”

Riding a 102-race winless streak, Kahne missed the playoffs in 2015 and 2016. Speculation has hounded him for more than a year that he could be out of a job.

Hendrick earlier in the day, when talking about the hiring of Alex Bowman to replace Dale Earnhardt Jr., said any talk about the future of the No. 5 car would come on another day. After the race, he said he had made no decision on the No. 5 car for 2018.

So Kahne had to win the race. He lost the lead on a restart in the first overtime attempt to Brad Keselowski, and if he didn’t regain the lead on the next one, he might never could have shaken the reputation that he just didn’t have it to win these races.

“This just shows that I still want to win races,” Kahne said. “This shows that I give it all that I can to get a win and shows that I’m passionate about driving stock cars and can still win races, too.

“I have a deal through 2018 with Hendrick Motorsports. I hear a lot of things. It’s tough to say exactly what is going to happen because I don’t know at this point in time. I know me and Mr. H will figure it out.”

After the race, Hendrick talked about the near future rather than 2018 when asked what this win does for Kahne’s future.

“It puts him in the playoffs,” Hendrick said. “We’re excited about that. I hope this turns the corner.”

Kahne won a wild event, one that took nearly seven hours to complete thanks to rain (104 minutes), a crash with 10 laps remaining (20 minutes) in regulation and another crash in overtime (24 minutes).

Kyle Busch dominated the first 110 laps before a crash battling for the lead with Martin Truex Jr. with 50 laps remaining.

The last 50 laps turned a typical Brickyard dud of a parade that Busch dominated into a free-for-all. The race at first appeared as if it would then come down to fuel mileage. Then five wrecks involving 19 cars in the final 17 laps contributed to the craziness.

One of those wrecks came as Jimmie Johnson, Kahne and Brad Keselowski were three-wide in a turn. Johnson, whose car appeared to be blowing an engine and smoke billowing out of the rear of his car, ended up spinning into the wall.

“You still can’t [go three-wide],” Keselowski said. “[In the movie] Tin Cup,’ [he] didn’t think he could hit it over the water, but he still tried, right?”

Kahne’s win had some controversy as well. He thought Keselowski jumped a restart on the first overtime attempt, where a wreck occurred as the cars hit the start-finish line and Keselowski was ruled the leader.

On the next overtime attempt, Kahne took the lead. As he headed down the backstretch and before he reached the overtime line, where the race would be official if the caution came out, a wreck began behind him. The caution didn’t come out until the leaders had gone well past the overtime line.

NASCAR executive vice president Steve O’Donnell said it treats every caution as the final attempt, and wanted to try to let it play out. He also said, in retrospect, there was enough oil on the track that they likely would not have been able to restart the race as darkness began to set in.

There’s no doubt, though, that Kahne earned it.

“He drove through the oil dry,” Keselowski said. “He didn’t just drive through it, he drove [the car] in there, and it stuck. Lots of credit to him for getting it to stick.

“It was impressive. I didn’t feel like I could do that if I was on the bottom lane.”

After the race, Kahne went to the infield medical center after suffering from dehydration and cramps. The race had sucked a lot out of him, probably much like the past three years of struggles at Hendrick. After receiving fluids, he certainly beamed over the victory in a race.

“It’s one of those things, you as a driver, all you’re trying to do everything correctly [at the end]. … As an elite driver, you want to win that but there’s a bunch of guys that want to win it,” Kahne said. “You do all that you possibly can and it fell in our favor today.”

Whether there are any dark days ahead for those on the No. 5 team remains to be seen. For now, they will savor the memory of having won the 2017 Brickyard 400.

“For me, working at Hendrick, it’s been very stable, which is really nice,” Kahne crew chief Keith Rodden said. “But when you’re not winning races and not getting the job done, I think you have your own answer [about your future].

“I don’t worry about it. I just try to keep the team guys focused.”