Not quite. Effects only fail if their conditions can't be met - for example, if Tragic Hero had said "Trash this to gain a Treasure"[1], then that wouldn't activate. However, instead, it goes like this:
Play a King's Court from your hand
- Select Tragic Hero to play 3 times
- Play Tragic Hero 1st time
- Draw 3 cards
- Get +1 Buy
- Play Tragic Hero 2nd time
- Draw 3 cards
- Get +1 Buy
- You have more than 8 cards in hand
- Trash Tragic Hero
- Gain a Treasure
- Play Tragic Hero 3rd time
- Draw 3 cards
- Get +1 Buy
- You have more than 8 cards in hand
- Try to trash Tragic Hero, but you can't (it's no longer in play)[2]
- Gain a Treasure
[1] "Do X to do Y." in Dominion is equivalent to "Do X. If you did, do Y." so you must do X if possible, but you only do Y if you successfully did X. "You may do X to do Y." is the same except that you choose whether to do X, then you do Y if you did X successfully.
[2] This is the Stop-Moving rule. Tragic Hero's effect comes from being played, so it expects to find itself in play. It isn't in play, so it can't trash itself.