Ginny: Yes, if it felt like the most appropriate action.
I've done it once with DGS (about 2.5 - 3 yrs old at time) - not for something dangerous either, but for a wilful act against his little sister, out in the street where time-out wasn't an option, and reasoning had clearly failed because he had already been warned not to do what he did .
He didn't repeat it again after the smack, and now, a year on, he knows that I mean what I say, and the threat of time out is usually very effective. I've no plans to ever do it again, but wouldn't rule it out completely.
I did feel guilty because his parents don't smack (normally), so I felt I'd gone against their principles. However, I obviously told them what had happened and they admitted that actually they have done the same themselves once, in a similar situation, and that I'd done the right thing.
Deep down, I probably knew that his parents would understand. Would I have done it if I'd known that they had extremely strong anti-smacking views? I don't know. Possibly - when the situation arose, I think that my reaction was too quick for me to take that into account, and his parents could have reacted very differently when told!