Raymond Chandler (The Big Sleep) is one of my favorite authors, but one quote of his makes me queasy. "When in doubt, have a man come through the door with a gun in his hand."
Maybe he shouldn't be blamed for every TV series that turned to a forgotten cousin or a guest celebrity playing himself or a character jumping a shark. Too many stories get spoiled by adding events and conflicts that did not grow out of the characters or the premise. I'm all for surprises and revelations. They are absolutely necessary to hold the attention of readers and viewer. (In some genres, secrets are foundational and expected.) Unexpected twists have the effect of forcing reflection on all that has gone before. And they deliver insights that are otherwise unavailable.
But throwing in something from out of the story world, something without a setup, or excessively broad does not deliver on the promise of the story. A rampaging robot or a surprise witness or (sometimes) a man with a gun who has no reason to be there -- other than to juice things up -- may get a visceral reaction (distract the audience from a plot hole), but the story is sacrificed.
Sometimes, as in comic books, adding archvillains is just part of the deal. The special powers of these characters become part of the premise for each new story. Ideally, the premise that comes with the new nemesis, once added to the superhero's world, is not violated, it's developed. But this is not the same as adding a new layer of conflict to a story that doesn't fit the world. I hate it when a series I like introduces an evil government entity that suddenly stirs up trouble. And not just because it is a cliche. The protagonist is being tested in new ways, to be sure. But the tests have nothing to do with with established character's needs and wants. To me, this spoils everything that went before. It's like putting salsa instead of icing on a birthday cake.
As a writer, you can get away with a lot. Look at magic realism (a genre I'm fond of). It provides surprises that verge on discontinuities. But they do not cross the line. Twists can be as extreme as you want them, but they need to be organic. They need to belong in your story. So check your work before you write "The End."
Be fair -- Make sure you've provided the clues, evidence, and tone that keep you from destroying verisimilitude. If your protagonist is going turn out to be a nattily dressed golem, include hints of clay on his bowtie somewhere before the revelation.
Integrate the idea(s) -- Make sute the introduced concept impacts every element of the story it should. Be especially cognizant of how the resulting conflict challenges something important about the protagonist.
Make it consequential -- Don't introduce a conflict that does not create changes that persist beyond the relevant scenes or episodes. Make it matter for the whole arc of the story. If the cousin is revealed to be a monster intent on conquering Earth, the rest of the family, going forward, needs to be viewed with suspicion.