Gayle had made 38 off 18 balls for the Royal Challengers Bangalore when he swiped a Ravi Jadeja full toss towards the long-off boundary.
The ball was heading for Gayle's fourth six of the innings but McCullum intervened to pull off what appeared to be a remarkable catch.
Highest earners in the IPL Wed, April 5, 2017
Express Sport brings you the top 10 highest earners in the IPL
Play slideshow Cricket Australia/Getty Images 1 of 10
10. Shane Watson (Royal Challengers Bangalore) – $1,425,000
But the powerful West Indies batsman was told to stay on the field by the umpires who wanted to check whether the Kiwi had stayed within the field of play.
And slow-motion replays showed that while McCullum had kept his body within the boundary, his wide-brimmed sun hat had made contact with the rope and the umpires were forced to signal six and recall Gayle to the crease.
IPL star Brendon McCullum was within inches of dismissing Chris Gayle
Brendon McCullum appeared to have pulled off a piece of brilliance before replays showed otherwise
Legendary South African fielder Jonty Rhodes quickly had a tongue-in-cheek word to say about the incident.
"Hats off to a brilliant catch [sic] Brendon McCullum," he said on Twitter.
Gayle, who had just passed 10,000 runs in T20 cricket, went on to rub salt in the wound by making a fine half-century before being trapped LBW for 77 off just 38 balls.
Get Quotes on Home Insurance