I think most people overestimate guns and underestimate knives. I have done a lot of knife fighting practice including working with airsoft guns and training knives and the gun is at a serious disadvantage at close range. Studies done on crime stats in the US have found that the average gunfight takes place at night ,both people fire several shots and no one is hit.I have practiced fighting people with handguns using a knife in particular and am quite confident that unless someone gets the drop on me from a distance I have the advantage. At the range you have to be to be safe from a knife a handgun becomes much less accurate.
This is not just my opinion but is taught to police and is also what most martial artists with knife skills think also. The main thing is to close the distance fast.