In NASCAR, the fastest car doesn't always win the race. Sometimes that works in a driver's favor and sometimes it works against him. In the case of Dale Earnhardt Jr., it's worked both ways in just the last three weeks.

At Talladega Superspeedway last month, Earnhardt had by far the dominant car, but he wound up finishing second in a controversial green-white-checkered finish that saw Kevin Harvick trigger a race-ending crash and Joey Logano win by inches over Earnhardt.

More from FoxSports

Had the caution flag for Harvick's wreck come out a second earlier or a second later, Earnhardt would have won the Talladega race and would have advanced into the Eliminator Round of the Chase for the NASCAR Sprint Cup. Instead, Earnhardt was knocked out of the Chase.

But in NASCAR, the karma wheel always seems to come around.

Sunday night at Phoenix International Raceway, it was Harvick who had the dominant car in the Quicken Loans Race for Heroes 500. Harvick led 143 of the first 199 laps and appeared headed to his fifth consecutive victory at the 1-mile PIR oval.

But shortly after Harvick pitted under green, surrendering the lead on Lap 194, backmarkers Ricky Stenhouse Jr. and Joey Gase crashed to bring out a caution on Lap 197, Earnhardt was the beneficiary. With rain moving in, the pace of cleanup of the Stenhouse-Gase accident was, to put it politely, leisurely. Extremely leisurely.

The track stayed yellow for about 20 minutes, with a total of 23 laps being run under caution. Finally, just as NASCAR gave the field the one-to-go signal to resume racing, rain began falling. The race was then red-flagged, and finally declared official with Earnhardt the winner and Harvick second.

Afterwards, Earnhardt thought about what the contrasts of those two races.

"We were sitting here in Victory Lane tonight and thinking about what four to six inches would've mattered at Talladega," Earnhardt said. "We'd been going to Homestead with a chance to race for the championship under the circumstances. It works out for some people, and some people it doesn't. This is a quirky little sport with weird days, and this is one of them."

During the marathon six-hour rain delay at Phoenix, the Talladega race was replayed on TV, but Earnhardt wanted no part of reliving it.

"All the fans were on Twitter going, 'Watch it, it's on TV,'" Earnhardt said. "I don't watch that stuff. It's just going to piss me off. But everybody was talking about how awesome it was and the moves we were making and the things we were doing out on the track, and we did have a hell of a day that day. At the end of the day I was really proud of what we did at Talladega and how we ran and some of the stuff the car was doing and I was doing. It was pretty awesome.

"It's a shame that we didn't win that race because it was pretty damned badass how we drove that race," Earnhardt said. "The whole lead-up into Talladega was about dad's 15th anniversary and how he came from 20th or whatever with 10 laps to go and won. Well, I just about rivaled that race with that run we had at Talladega, but we didn't win, so nobody is ever going to remember that one. But that was what I was kind of disappointed about that more than just the win itself. But that's the way it works, you know. This is a numbers and inches -- it didn't add up for us."

Earnhardt's crew chief, Greg Ives, an engineer by trade, had a very pragmatic take on the two races.

"When you look back at the record book, it never says next to the name 'stolen, the race win,'" Ives said. "Joey Logano won that (Talladega) fair and square, as Dale put it, nice and clean. He said we played by the rules and lost by the rules. Tonight we played by the rules and won by the rules. You know, that's how it works. I can never -- you've got to put yourself in position to win, and when it happens, it's never going to say why we won or how we won, it just says we're first."

And on a long, rainy and cold night, Earnhardt, Ives and the rest of the No. 88 Hendrick Motorsports team won, which at the end of the day is all people will remember.