Wulf Ratbane said:(a) who can shoot first and (b) who can not get shot.
But that sort of game invalidates all sorts of otherwise interesting character concepts, because it's just no fun to (a) not shoot first and (b) get shot and killed.
And with that level of realism, the PC's will have to take effective countermeasures for getting shot or not getting the first shot off:
1) Talk your way out of more confrontations
2) Burn the requisite feats to draw faster and shoot more accurately
3) Travel tactically, moving half the party while the other half provides overwatch
4) Look at every encounter tactically, knowing where cover, concealment and the best firing positions are...
...various other things that will slow down the action of the game, while adding scads of realism.
One thing that I've seen happen when scads of realism are added to any game, though, is that the roleplaying doesn't reflect the changes. When both sides of a conflict know that someone among them is going to die when triggers get pulled, you have a lot less heroism, even if the engagement goes hot. Add to that laws of the land, where killers could be caught, tried and probably killed, unless the incident was clearly self-defense, then you have many many reasons not to pull triggers.
Depends on what you and your players want to do with the game, though...
As far as the history of gonnes... it's what Wulf said: Guns got to the point where they had the cheapest ROI. Anyone could pick up a gun and be relatively accurate after a few hours of training. Not so with longbows, swords, and crossbows. This fact changed the entire philosphy of war in Japan, of all places, when the gun was introduced there.
And, if you add realistic benefits, then you also have to add realistic drawbacks: wet/bad powder, poor weapon design (or just bad luck in some cases) that blows up in your face, the massive cloud of smoke (Obscuring Mist?) that can be used to either side's advantage, long reload times, the fact that anyone near and in front of the firer is going to be deaf when the gun goes off (and possibly disabled and have powder burns -- thus no more firing into melee)... etc.
In a D&D scaled engagement, I've always assumed that everyone gets one shot, then it's back to swords, knives, spears and riflebutts. Last of the Mohicans had some great illustrations of this kind of small scale fighting...