It's kind of like having a kid that cuts up and then before I can say anything, the kid goes "oops! I'll go to time out now!" and heads off. Like, what do you do with *that*?
I would be more inclined to relate it to having a kid that breaks a rule and then runs away before they can be reprimanded. He's pushing the boundary and anticipating a reaction - if you don't give him one, that boundary will eventually cease to exist in his mind.
I agree with the advice already given. Ultimately, this is undesirable behaviour and he has done it more than once. I had one incident that was very similar to yours but a touch more serious - where a horse (my fault for having my back turned) came up behind my and tagged me good on the shoulder, then bolted to the end of his paddock. I whipped around and got after him, it matters not that he was already running away. He never tried that stunt with me again.
I have a zero
tolerance policy with mouthy horses. It's probably my most hated vice, and the one I've run into the most frequently. I've tried all sorts of varying degrees of dealing with it - I too wanted to allow "mutual grooming" behaviour, tried to establish mouthing was okay but teeth were not, etc. Been there, bought the T-shirt, and have no desire to go back. What I've learned after dealing with this 50 bajillion times, is that when I handle any horse the first thing I do is establish my (generously large) perimeter of space. You don't have to round pen them for half an hour to make it clear - I praise them when they're out of it, and correct them when they enter it. Lo and behold the mouthy ones are usually the first to enter my space and insist on claiming it. Some only do it when grooming or any other time where mouthing may have been "allowed", some only do it when expecting treats, those are the easiest to deal with because you can just stop allowing it.
However some horses I've met are just absolutely fixated on being in your space and mouthing you to death; I don't know if it's a mental thing, if it's a deeply ingrained habit from foalhood, or what, but these ones are way up there on horses I do not let my guard down with. I don't draw the line at teeth, I don't draw the line at mouthing, with these horses I've found that the only way to deal with it is to be very strict with personal space. If they're in my space, they're gonna mouth, and if they're gonna mouth, teeth are going to sneak in on occasion, if they don't ultimately decide to escalate to taking my hand off. If the line is drawn at personal space, I don't get hurt (which is my priority) - however with these ones I found I had to enforce that boundary CONSTANTLY. Consistent handling and time seemed to be the only things to make a difference, but it's tiring - and to me, absolutely necessary.
Thing is, I've yet to see a horse that didn't have what I'd consider to be an "issue" with mouthing, even care to bother doing it. If a treat is offered, they take it and either look expectantly or move on with their lives; if their special spot is being scratched, there are countless things they'd rather wiggle their lip against than me
In regards to the question about what to do when a horse has learned to strike when you can't respond appropriately, all I can really say is get creative. Going off the assumption that he's actually made a habit of this, then I'd plan ahead for it. Talk to the farrier beforehand so that when he bites the farrier can get out of the way quickly while you give him heck. If it's a pony ride (assuming you're leading him) then again a plan of action ahead of time would probably best, I'm assuming it's a sneaky nip, and the correction would depend on the severity of the nip and how sensitive he is to correction. You don't want to back him up or start moving his feet around with a child in the saddle, but depending on the situation, I've issued a smack and a reminder of my personal space. As with selling him...prep work. Again assuming this is a habit - it should be dealt with before selling (if it's for whatever reason just with new people, maybe bring in some fake "potential buyers"), or the else the issue should be disclosed to the potential buyer anyways in which case correcting him would not be the issue.
Skittles, to simplify what I've said above, once the innocent treat lick results in a nasty chomp, most tend to see it in a different light.