It may be my imagination, but Gunners seem to be the most perceptive human mobs out there - they can see (and hear) surprisingly far at times. My guess, though, is that they were responding to the ghoul, not you, since they lost interest once the ghoul was dead. Ghouls are noisy. Of course, how they knew the ghoul died is another matter...
Also, mobs of all kinds will throw any old area-of-effect attack in the general direction of the last known location of an active, but hidden, threat. I've had Super Mutants attempt to blanket my sniping positions with missiles, for example, after I'd snuck well away from that position, and I couldn't count the number of times raiders have lobbed grenades in my general direction after I'd found cover. The general rule seems to be that If they see you, they'll come for you; if not, they'll throw a volley of spray-and-pray fire at you, then wait for you to show your face again before firing.
It is uncanny that mobs can telegraph focus-fire positions to each other so precisely, though.