I have tried that, unfortunately, to no avail.
Now that I'm thinking about it, however, I don't believe my initial assessment of how the bug occurred can be correct. If my attack had been disabled the moment I entered the NPC, I wouldn't have been able to kill my enemy.
So I guess I don't know what caused it.
Have you tried to dismiss your companion (to force a despawn)? His interaction icon is still visible, so you might be able to engage in conversion with him.
Anyway, very interesting bug. Never heard of such a thing happening before.