When he accidentally touched the nail, he received such a shock that it threw him across the room. He had made a connection between the inside charge and the accumulated outside charge, and since these were opposite signs (one positive and the other negative) all the accumulated charge flowed through his body.