Well, a .22 isn't really that powerful of a load. Plus you have to pull a hammer back and the slightest twitch is going to send the bullet flying even if you didn't mean to shoot. This could get you in hot water.
If some nut case comes after you in a dark alley there is a chance that the person could be under the influence of drugs, alcohol, or just plain determined. A .22 is not really going to do that much damage unless you hit them in the head. The downside to this is that the person could potentially keep coming at you, and you are going to have to keep pulling the hammer back with each shot. So, the odds are that you would only have a chance to fire once before the person is on-top of you. Every second counts in a physical confrontation.
You also have to remember that in a "stressful panic" situation the odds that you are going to hit them in the head is a long shot. Your adreneline will be pumping, your nerves will be frazzled, and you may not perform like you think you will. Just an FYI.
I would recommend you get at least a .38 as a self defense weapon. There are several S&W and Taurus revolvers that are compact, six shots, and reliable. A .38 will do some damage, and you will not have to worry about pulling back a hammer with each successive shot. You can fire in double-action until you run out of ammo. The .22 would NOT be my recommendation for anything other than a target or varmit gun.