DETROIT – A seemingly brilliant gamble. A dazzling display of courage and hand control. A blessing from the racing gods just when he needed one. It was all coming together for Marco Andretti during Saturday's rain-shortened Chevrolet Detroit Grand Prix.

And then, all of a sudden, it was gone.

As the result of a controversial decision by IndyCar Race Control, the gamble turned out to be all risk and no reward and his show-stealing exhibition, a needless waste. Andretti finished the first half of the Detroit doubleheader 16th.

"We got hosed," a still fuming Andretti told IndyStar after the race. "We deserved better."

Penske domination continues:Josef Newgarden conquers timed race in Detroit

Early in Saturday's race, which was reduced to a 75-minute window after rain delayed the scheduled start for more than an hour, Andretti and team co-owner/strategist Bryan Herta decided to pit and become the first car to put on slick primary racing tires.

What ensued was breathtaking, the highlight of Saturday's race. NBC cut to Andretti's in-car camera to watch the third-generation driver put on a rain-racing clinic. Despite numerous close calls, Andretti kept his No. 98 Honda off the wall with some incredibly fast hands, willing the car around the track and hanging on for dear life as he did.

"Marco's so good in those conditions," beamed proud father and team co-owner Michael Andretti.

Running dead last at the time, Marco Andretti held off the race leaders as he prayed to the racing gods for a yellow flag that could flip his fortunes. A yellow would allow for him to cycle to the front of the field while much of the rest of the field pitted. It was a calculated gamble called for by Marco — and a wise one given the tricky conditions of the rain-soaked track.

It wasn't a surprise, then, when their prayers were answered, as a yellow flag flew when Ed Jones ran into the tire barrier in Turn 7 and caused a full course caution.

"I thought we were golden," Michael Andretti said after the race. And by "we," he didn't mean just Marco Andretti. Not long after Marco Andretti pitted for primary tires, so did his teammates, Ryan Hunter-Reay and Zach Veach — along with Josef Newgarden and a couple others.

"We would have been sitting second, third and fourth," Michael Andretti said "But then they opened the pits. It’s bull (expletive). I was shocked when I saw it. ... It was just wrong."

Instead of keeping the pits closed and making the field cycle around the track another lap to the benefit of the cars that pitted, race control opted to open the pits early in hopes of getting more green flag racing during the timed race.

"Race control was reviewing data and closing rates and based off the information the pack-up was developing," IndyCar official Mike Zizzo told IndyStar. "The goal was to get the pits open as quickly as possible for the competitors and fans, but given the circumstances that included cars on different tires and a cold track, it did not occur as expediently as was envisioned."

As a result of the decision, Marco Andretti's heroics and the team's bold strategy call went for naught.

Not long after leaving race control following the race, Herta told IndyStar, “unfortunately, decisions made in real time are often not perfect."

Added Marco Andretti: "We took the risk. We outsmarted them. I kept it off the wall in the toughest conditions. We were the show of the race, and then they opened the pits. It’s just a bummer. Rules are rules, but I’ve been here 14 years and they don’t open the pits when I'm 3/4s of a lap back. We outsmarted them, and we got hosed."

While it will offer little solace to Herta or Marco Andretti, race control's ruling did benefit teammate Alexander Rossi.

If they had kept the pits closed, Rossi would have been cycled back to seventh and would have had little time to work his way back up to the front.

Instead, because they opened the pits early, he maintained his spot at the front of the field and finished second.

"At least Alex got lucky," Michael Andretti said of his driver who now sits third in the championship behind Saturday's winner Newgarden and Indianapolis 500 winner Simon Pagenaud. "He’s the one who would have really been screwed, so he should be happy. I guess it worked out for us in that way."

Folllow IndyStar Motor Sports Insider Jim Ayello on Twitter, Facebook and Instagram: @jimayello.