I would certainly never refer to KOTOR as a masterpiece. In some ways TSL is a vast improvement over the original, in others not so much, but I enjoyed the overall complexity much more.
For every muddled happenstance (i.e. the awkward reunion of the remaining Jedi) there was a moment of sheer brilliance, that first dialogue with Atris being a prime example. In fact dialogue overall was a vast improvement over KOTOR, the exile is given the chance to be a fully fleshed out protagonist with depth and history. History! A fantastic approach to the past, the fact that we never SEE the conflict, we can only hear it from different perspectives and make our own judgments. I think it an enormously effective tactic, drawing the player in, forcing us to think and to question.
As for undeveloped characters, the depth (of lack there of) of Nihilus and Sion is to be expected given the overall theme of secrecy. To some extent they are decoys for the real antagonist whose depth and motivation put a thuggish Malak to shame. And Atris, oh Atris. To be honest we are given plenty of allusions towards her character and her feelings towards the exile, past and present.
Though flawed you have to admire TSL's subtlety and the regard it extends towards the player, allowing us to actually think and deduce as much as we like, as opposed to being told.