Bahranian striker Mahmood Al-Ajmi (76th minute) helped Gokulam take a shock lead after a barren first half, but two minutes later Dipanda Dicka levelled for the hosts (78th).
Uganda striker Henry Kisekka (90th) then volleyed home the winner in thunderous fashion as Dicka had a chance to equalise again in second-half added time but his strike cannoned off the bar much to the chagrin of the motley home crowd.
The result saw the Green and Maroons stay at fourth position in the points table having 21 points from 14 matches. Bagan are eight points behind league leaders Minerva, who have played 13 matches.
Gokulam, on the other hand, moved off the foot of the table to ninth spot with 13 points from the same number of ties.
They pipped fellow southern outfit Chennai City FC on better head-to-head tally record.
The hosts made one change from the last match against Chennai City, with S.K. Faiaz replacing Azharuddin Mallick in the midfield.
The first half saw chances few and far between as in the 38th minute Mohun Bagan's Akram Moghrabi tried to head in Nikhil Kadam's good-looking cross but goalkeeper Bilal Khan blocked the attempt at the right time.
Just at the stroke of half-time, the visitors had a chance to take the lead when Al-Ajmi tried to flick the ball above Mohun Bagan keeper Shilton Paul but failed.
The best chance of the game fell to the hosts after the break when Lebanese Moghrabi missed a sitter after Arijit Bagui had set him up three minutes into the hour mark.
Moghrabi was replaced by new signing Nepalese Bimal Magar in the 65th minute as Shilton D'Silva replaced Cameron Watson.
But a peach of a strike from Al-Ajmi saw the visitors take the lead. Ghanian defender Daniel Addo lobbed the ball for Kisseka who controlled it and set up Henry who crossed for Al-Ajmi who slotted it in with ease between two defenders.
Gokulam though had the last laugh as Kisekka whipped in a powerful volley out of the blue after controlling the ball well from a throw-in.
Dicka got a chance to level again but his effort came off the bar in second-half stoppage time.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)