Hmm, I seem to be able to trigger the Charm canceling and combat ending quite reliably, for example using this save: https://www.sendspace.com/file/wg860q
I just attack the sailor with my rogue, then stop attacking. Cast Whispers of Treason with the Cipher, and soon after the Charm effect is ended and combat restarts.
It actually gets a bit weirder though, see the attached screenshot. After the Charm hits the sailor and before it turns back off again, the sailor is actually attacking himself (in that example I used Shadowing Beyond with my rogue, but that turns out to make no difference for either the Charm and combat ending or the sailor's self-destructive behaviour). Quite possibly this is because the sailor has "auto-attack" in his action cue, and it lacking a valid target somehow substitutes himself for that. Regardless of whatever other fixes are applied, it would probably good to reset the Charmed character's action queue after the SwapFaction effect is applied, to make sure weird stuff like that doesn't happen.
However, it also demonstrates that the charm+combat ending is actually a different mechanism than the 'normal' premature charm ending. Because the sailor in this case does have a target (even if it is himself), the Charm effect actually doesn't end prematurely. This is also confirmed by having Eder initiate combat somewhere else on the map, and then attacking and charming this sailor. In this second scenario where Eder remains in sight of (uncharmed) enemies, the sailor remains Charmed for the duration of the spell or until he knifes himself to death, whichever comes first (the death-knifing, as it turns out). So what is happening here (in the first non-Eder scenario) is actually that combat ends first, because there are no hostile enemies in sight of my party anymore. Because combat ends all the combat-only effects end as well, including the Charm effect. This turns the sailor hostile again, restarting combat mode.
Thus, there seem to be three separate issues that need fixing:
A) a charmed enemy potentially attacking himself -> probably fixed by resetting the action queue
B) charmed enemies prematurely becoming uncharmed -> almost certainly fixed by the change I proposed earlier in the thread
C) combat ending when all enemies are charmed (and immediately restarting again once they uncharm as a result) -> a possibility to fix would be 1) to extend the "no hostiles in sight" time interval; in conjunction with the solution for B) that presumably would turn someone hostile again before this runs out; and/or when this time interval expires, first looping through all the non-hostiles in visible range and removing all Charmed/Dominated/Confused effects on them until there is at least one hostile character again (if any).
I'll see if I can find a less self-mutilaty NPC to get a good savegame to produce scenario B as well. Should be able to find one.