Always more to find
Good catch, thanks, will be fixed next update! The issue here was that PS checked the target of the move to determine whether it was knocked out by the user, but the target of Sleep Talk is the user. Now it checks the actual opponent no matter what move is used.A Pokemon suffering from Nightmare shouldn't take damage from it on a turn on which it KOes an opposing Pokemon, similarly with Poison. See turn 27: https://replay.pokemonshowdown.com/smogtours-gen2ou-496601
Bulbapedia confirms this and it has also been verified on cart by Century Express.
No need for testing in-game, this has been implemented for a while: https://git.io/JfZAxA sleeping pokemon with sleeptalk or snore should be immune to flinch unless the attacker has kings rock, according to bulbapedia. Still waiting on the test on cart
Here's the relevant bit of the Crystal disassembly if you're interested: https://git.io/Jfnv4