With Lionel Messi having lit up Lusail Stadium with a goal and an assist, Argentina seemed to be coasting to a semi-final clash against Croatia, only for Wout Weghorst to hit a brace and seal a remarkable 2-2 draw.
Aston Villa stopper Martinez then took centre stage, saving from Virgil van Dijk and Steven Berghuis as the Dutch fell 4-3 on penalties to Argentina in a repeat of the 2014 semi-final.
But after the win, Martinez hit out at both Van Gaal and referee Antonio Mateu Lahoz, who struggled to keep a lid on an emotional encounter which saw more than one flashpoint between the squads.
"It was a tricky game," Martinez told beIN Sports.
"I thought we controlled the game really well. We went 2-0 up, basically we controlled the game. The ref was just giving everything for them.
"He gave 10 minutes (stoppage time) for no reason. He was giving free-kicks outside the box for them, like two, three times.
"He just wanted them to score, that's basically it. So, hopefully we don't have that ref anymore. He's useless."
Of the Netherlands boss, Martinez added: "I heard Van Gaal saying, 'We've got an advantage in penalties. If we go to penalties we win.'
"I think he needs to keep his mouth shut."
Messi, too, claimed Lahoz was not up to the task of taking charge of the games.
"It (the equaliser) came from a set-piece that I don't think was a foul," he said.
"But that is how the referee was during the game. I don't want to speak about referees because you can be sanctioned. I don't think he was up to the standard, he was very harmful for us."
Messi provided a moment of magic to break the deadlock, playing in Nahuel Molina with a reverse, no-look pass before doubling the lead with a second-half penalty.
But it was Weghorst's introduction that brought about a comeback that was as unexpected as it was scintillating.
The big striker brilliantly headed in Berghuis' cross and then, when a last-gasp free-kick was awarded, instead of shooting, Teun Koopmeiners rolled a pass into the area, where Weghorst held off his marker to equalise - a move Van Gaal revealed the striker introduced to the squad and had been worked on in training.
Captain Van Dijk and Berguis saw the first two penalties saved by Martinez.
Argentina's Enzo Fernandez then fired wide, but Lautaro Martinez hit the winner.
Unlike his captain or goalkeeper, Argentina coach Lionel Scaloni refused to discuss the performance of the official, who showed 15 yellow cards during a game Scaloni described as "heated".
The loss was the first experienced by Van Gaal since he returned for a third stint in charge of the Netherlands, with the 71-year-old now retiring from management for a second time.
"At the end of the day I think the score was quite right and in extra time we didn't really give away chances," he said, having also been in the dugout for the defeat in 2014.
"This was my very last match. My third term as a head coach. In that time I coached 20 matches but I didn't lose a single one. I think it is Google you can look that up on.
"I had a wonderful time and yes, it is incredibly painful to see how we have been eliminated. Particularly because I did everything to prevent this from happening."