I think you're along the right lines, the two main harms to avoid relate to "misleading the audience as to the type of story being told". There are fun ways to be misled (which we end up calling "misdirection" with hindsight) and there are not-fun ways to be misled (which we end up calling "stupid GM tricks" or "inconsistency" with hindsight). The main not-fun effects are:
If players expect a particular thing from your game and don't get it (because you subvert a fair expectation that they'll get it) then they might well be disappointed in the game. "They promised us jet-packs!".
The "type of story being told" informs the players to some extent how to play the game, that is to say what kinds of actions will have what kinds of results. For example, protagonists "get away with" different kinds of risk in different genres. If you subvert the players' expectations in this respect then they might well become frustrated that they can't act appropriately. "Why isn't this working?"
For an example of the first, suppose aliens kidnap their fantasy characters (Star-Lord style) and insert them into an SF genre. Players who really weren't in the mood for Big Space Ships (or who never like them) would be disappointed. They don't get to play the game they thought they signed up for.
For an (extreme) example of the second, suppose that you run a game giving every appearance of a Jackie Chan-style movie setting, but then every attempt to "do something fun or cool" imposes a penalty on combat rolls for not maintaining proper form, and their characters are incapable of the usual semi-plausible stunts like flinging themselves on or off moving vehicles, all because "that's not realistic". Players will be frustrated that every time they do what it aparece they're supposed to do, you (or the game rules, or gravity) penalise them. These genre hints can be quite subtle, and it's not all that hard to do this accidentally when players have different views of the genre you're playing.
So, for your particular example, if you want to kill off a character that the genre/style of the game would seem to indicate is fixed, you have to avoid those two things:
Make sure the players aren't counting on that character for their enjoyment of the game. This usually just means making sure there are plenty of other sources of fun, and fun to be had in reacting to the death. But a player who thinks of the game as being sobre their character's relationship with X might well see the death of X as the beginning of the end of the campaign, and basically figure their plot arc is complete once the consequences of X's death are played out. This more or less rules out killing a PC solely for the purpose of genre-subversion -- I'm not saying it can't be done, but it's liable to disappoint at least one player unless you compensate for that by ensuring it's more than just a "gotcha!" moment.
Make sure the death doesn't cause the players to question whether they're playing the game right. If they care about X, they might suddenly go max-defensive on every NPC they care about on account of the game having "punished" them for not defending X, and they might feel the "punishment" was unfair if nothing in the game indicated that X was vulnerable. Unless that's really the way you want the game played, you have to be careful not to provoke the players to play it that way.
There are also some genres (noire detective, horror) where the players will be disappointed if there não é an unexpected death. So depending on what you want to achieve, dropping genre-based hints that a major NPC death is the kind of thing that can happen, might be a good way to ensure that when it does happen it's a surprise of the form, "oh no! X is dead!" rather than a surprise of the form, "oh no! This game involves death!". A classic example is Psico, where it's no surprise at all that Norman Bates is a killer, but the film nevertheless subverts the expectations of its genre.
A sudden change in direction of the game needn't be either disappointing or frustrating provided that the new expectations are still clear. "Up until now it was an action adventure story, now there's a big reveal and it becomes a Cthulhu-mythos horror story" is absolutely fine provided that the players can switch with you and are interested in mythos. So long as the reveal is clear enough, they realise that in a Cthulhu story the stakes involved in getting into a fight are way higher than in the action adventure story, they can act accordingly to give their new antagonists the appropriate respect, and there's no frustration. OK, they probably end up dying where previously they were wading through enemies with ease, but they understand why.
A surprise which makes the players think, "ah, now I understand!" is usually going to be easier for them to get behind than a surprise that makes the players think, "what? None of this makes sense any more", although the latter is more challenging. So if your big reveal can release a tension ("OK, so isso é why the mooks have all seemed kind of unhinged: they're cultists!") as well as create one ("uh oh, we are really out of our depth with these extra-planar horrors") then it will feel more logical and probably more fun.
Finally, if the players know all along that their expectations are likely to be subverted in some unknown way (because you've told them that's what you like to do or shown them that in your previous games) then they'll find it easier to follow the change when it happens. Knowingly playing a bunch of rubes whose minds are about to be blown is often more fun than ser a rube whose mind is about to be blown, but it's a different (and perhaps lesser) form of expectation-subversion when it actually happens.