Dheeraj and his friends were having a party. He could be seen carrying the pistol around in a CCTV camera footage, they said.
It seemed he was drunk and was trying to fire in the air, police said.
When his friends were trying to pacify him and take away the pistol, it "accidentally" went-off and Dheeraj was hit, they said.
Three of his friends have been detained while the others are on the run. Dheeraj was a part-time property dealer, police said.