With a significant lead and the laps winding down, Joey Logano kept thinking about getting to the white flag.

Less than a half-lap from finally seeing that wave at Texas on Monday, a caution changed everything — though only for a few extra laps.

"My heart dropped. I got really angry instantly," said Logano, who was in the third turn on the 333rd of 334 scheduled laps when the caution happened. "You've got to go out there and win at that point, figure out how to do it."

Logano still got the victory, just in a more exciting fashion. He passed Jeff Gordon on the last of 340 laps after a green-white-checkered finish in the Sprint Cup series version of overtime.

When Kurt Busch slammed into the wall, spewing debris on the track, Logano's 2.2-second lead over teammate Brad Keselowski was gone and he didn't get to take the white flag that would have guaranteed no extra laps.

On the ensuing pit stop, Gordon took only two tires and exited first. Both Team Penske drivers took four tires, and Logano got a splash of fuel. But Keselowski missed a chance to become this season's first two-time winner when he was penalized for speeding on pit road and finished 15th.

"I was just trying to get a little too much on pit road," Keselowski said. "We're in it for wins. We're not in it for second. Second or 15th is the same for us."

The 23-year-old Logano got his fourth career victory, and Jeff Gordon took over the series point lead from Dale Earnhardt Jr., who had an early crash.

"He crossed over and got into the back of me pretty good," Gordon said of the last lap with Logano. "At that point, I was just thinking, 'I just want to finish.' Looked out my mirror, those guys were racing hard behind me. A great, great second-place finish for me."

Here are five other things that happened in the rain-delayed race at Texas:

7 WINNERS FOR 7 RACES: Logano became the seventh different winner in as many Sprint Cup races this season, when new rules for the championship Chase put an increased emphasis on winning. Team Penske joined Stewart-Haas Racing as the only teams with multiple winners this season.

JUNIOR'S MISTAKE: Earnhardt finished last for the first time in seven seasons with an early mistake that also made a long day for Hendrick teammate Jimmie Johnson. Only 13 laps into the race, Earnhardt drove his No. 88 Chevrolet halfway into the rain-saturated infield grass before it shot across the track and slammed into the wall in a fiery crash. Debris and mud from that damaged Johnson's windshield and front left side. "It was kind of surreal what happened," said Johnson, who later had a right rear tire issue and finished 25th. Earnhardt tweeted: "That wasn't fun. Sorry 2 the fans of the 88 team. Feel bad for my guys and the 48 team also. Made a mistake there that was costly for every1." The last time Earnhardt finished 43rd was the 2007 fall race at Phoenix — a span of 222 races.

HARVICK'S BLOWN ENGINE: Kevin Harvick has finished 36th or worse in four of the five races since winning at Phoenix the second week of the season. He started third at Texas, but completed only 28 laps because of a blown engine right after a restart and wound up 42nd. "It's frustrating. I don't know what else I can say," Harvick said. "I didn't get any indication that anything was going wrong."

FLAPPIN' IN THE WIND: The race started with 10 caution laps to make sure the 1½-mile high-banked track was ready for racing after being postponed Sunday by rain. There were jet dryers on the track during those laps, and the high-pressure air from those affected the hood and roof flaps on several cars. Keselowski made four trips down pit road after his hood popped up and his crew made repairs. "It was one of those freak deals," Keselowski said. Gordon said one of the jet dryers "about blew all of us over." NASCAR put all the cars in their original starting spots. "I'm not sure what's more odd, if that happened or NASCAR allowed those guys to repair that thing," Gordon said. "Had a piece of concrete fly through my car once at Martinsville. I don't ever remember them letting me repair the car."

STEWART LEADING: Tony Stewart was the polesitter and led laps for the first time season, and not only the first 10 laps during that competition caution to start the race. He 74 of the first 76 laps, and went on to a 10th-place finish. Those also made him the career leader for laps led at Texas Motor Speedway with 801.