The FBI and other federal agencies train at 7 yards for pistol marksmanship, I practice at 15 yards. For the average marksman chances are not so good. I've spent a lot of time at the range and the "average" is pretty low, but there are some guys that can shoot a fly out from between it's wings at 15 yards. My dad, for example, could shoot for 15 minutes into a grouping no bigger than a small salad plate. Eventually he ends up picking another spot on the target because there's a big patch of daylight shining through the middle.
I would probably be pretty effective inside 10 yards if I was going to headshots only. Really, the pistol is just an extension of your arms. Your blade gives you more reach than the zombies, and your pistol gives you a bit more reach than a blade. Ideally I would use a rife all the time, but a pistol is a good hold-out option.
Also, if you get cornered and you know you are screwed it's hard to off yourself with a sword. Call me a coward, but I would rather put one in my own head than be eaten or fall on my sword.