I remember that we had a lot of problem with friend/enemy toggle in the guard faction a while ago, I would toggle someone as friend to faction, then I'd check to be sure they were friend to faction and even then, the guard NPC would just go and kill them at first sight.
I think that problem have been solve since then... But faction marking have always been a bit glitchy. Sometime the enemy mark disappear and give the impression the guy won't get attacked by the NPC anymore, but in most cases they end up being killed by the NPC.
Since then, I always mark people friend to faction after removing the enemy to faction mark.
What I've learn with faction mark in the guard is, double check if he is friend, enemy or no relation with the faction. Check if someone else in your faction have the guy toggled to hostile. And if they have to go through "faction area only" places, mark them as friend to faction even they were never set as enemy before.
And if you really are not lucky, your own NPC will turn back against you... happened to me once