As Dwight Gooden closed in on throwing what had to be one of the most improbable no-hitters in baseball history, his catcher’s brain churned like Zach Galifianakis’ racing mind in the card-counting scene from The Hangover.

“You’re going over how you got each hitter out each time through the lineup -- the first time, the second time, the third time, and now the fourth time,” Joe Girardi said Friday on the 25th anniversary of Gooden’s no-no at Yankee Stadium. “We knew what pitches we want to get them out with, but how are we going to get there? We don’t want to fall into a pattern. You do a lot of thinking, about pitch selection more than anything else.”

There’s so much for Girardi to think back on from May 14, 1996.

Even now, after winning four World Series rings, after catching David Cone’s perfect game in 1999, after managing the Marlins and the Yankees and now the Phillies, Girardi regards it among the most memorable games of his career.

The night belonged to Gooden, of course. A fallen star after a half-dozen dominant seasons with the crosstown Mets, he sat out the last three months of 1994 and all of 1995 because of a drug suspension and had an 11.48 ERA through three starts in 1996. The Yankees might have removed him from the rotation if not for the aneurysm that threatened David Cone’s career and shook the organization.

» READ MORE: Phillies center fielder Adam Haseley returns from leave of absence

Gooden, then 31, no longer bore much resemblance to Dr. K, his flame-throwing younger self. He was crowned National League rookie of the year in 1984 and Cy Young Award in 1985, then led the Mets to a World Series championship in 1986. In his first three seasons, he averaged 33 starts and 248 strikeouts. From 1991 to 1993, he averaged 29 starts and 148 strikeouts.

But there he was, two outs from no-hitting the mighty Seattle Mariners despite issuing six walks when he uncorked a wild pitch that skipped past Girardi and moved runners to second and third in a 2-0 game.

Oh, and did we mention that Gooden’s 68-year-old father, Dan, was in a Tampa hospital awaiting open-heart surgery the next day?

“I just remember how concerned Doc was about his father,” Girardi said. “His father told him to go pitch. He said, ‘Come see me tomorrow.’ And that’s exactly what Doc did.”

After the wild pitch, Girardi went to the mound with Yankees pitching coach Mel Stottlemyre, who worked with Gooden in the Mets years. Given the stakes and the opponent (the Mariners -- with Ken Griffey Jr., Edgar Martinez, and 20-year-old Alex Rodriguez -- rallied to oust the Yankees from the division series one year earlier), Girardi recalled the 36th game of the season on a Tuesday night feeling “very much like a playoff game.”

Years later, Gooden said in an interview with Yankees Magazine that Stottlemyre asked how he was doing. His reply: “It doesn’t matter. I’m not coming out.”

» READ MORE: Phillies shortstop Didi Gregorius has struggled defensively this season. Larry Bowa isn't worried. | Scott Lauber

Gooden came back to strike out slugging Jay Buhner with a fastball and get Paul Sorrento to pop out to rookie shortstop Derek Jeter on his 24th pitch of the inning and 134th of the game (imagine that!). Girardi jumped up and down and ran out to the mound, where he was the first to embrace Gooden.

Girardi couldn’t recall much interaction with Gooden in the dugout between innings. It’s superstition for players to keep their distance from a pitcher during a no-hitter. But a catcher?

“If I had something to say it usually was when I went to the mound,” Girardi said. “But I stayed away. We’ve all heard of that jinx. No one talks to pitchers. I wasn’t going to be the one to screw it up.”

Not after a rocky first six weeks with the Yankees, who acquired Girardi in an offseason trade with the Colorado Rockies to replace popular catcher Mike Stanley. Known for his defense and game-calling, Girardi got positive early reviews from several pitchers, notably Cone. But he batted .243 with a .612 OPS through April, testing the fans’ patience.

Catching a no-hitter, then, gave him credibility with the paying customers.

“I think it finally gave me acceptance in the New York fans’ eyes, which is big,” said Girardi, who went on to win three World Series in four years with the Yankees. “My reception was not very good, especially the first month. No one wants to go to the ballpark and be booed a lot during the month of April. It kind of changed the course for me.”

» READ MORE: The Phillies' bench has kept them afloat during some difficult times | Bob Brookover

The Yankees left Gooden off the postseason roster in 1996. He pitched through 2000 but was mostly ineffective, posting a 4.87 ERA over his last four seasons. The no-hitter was his last truly great moment.

“He threw a number of pitches to get through it,” Girardi said. “There were times when he kind of pitched around a guy here and there. But it was a brilliant game, and God, it was fun to be a part of. I’m just thankful that Doc gave me that opportunity.

“Just the emotion of the day and being so concerned about his father, that he could take a pretty cool present to his father, it was a special night.”