Well, sure, but the key term there is 'within a few minutes of'. Holmes doesn't have minutes here - he has seconds. The shot is fired, somehow the gun gets in his hands, and moments later - note, the gun is still smoking, so it can't be more than ten seconds, if that - the door is broken down, and in come the cops. Had Holmes had even a minute to figure out what was going on, I have no doubt that he would be his usual, composed self, but that many things happening within a matter of a few seconds is enough to stagger anybody. And at this point, he'll have to come up with some pretty good evidence pretty quickly, or his protestations of innocence will sound like the same things all crooks say. THAT is where the proof of his Holmesian brain will come in, I'll wager - proving his innocence while stuck in a jail cell.