If ToEE hadn't been bug riddled at release then it would be a masterpiece as it is a near perfect computer game adaptation of the D&D 3.5 ruleset and combat, supported by a faithful recreation of a pnp adventure module.
Deus Ex is one of my favorite games but it sure as shit is not a masterpiece if going by the definition that a masterpiece is an as-close-as-possible-to-perfect work. Game is riddled with problems, specifically being far too easy given the amount of options you are given, enemy AI is braindead, which allows stealth to be too easily abused, it was a pretty bad looking game even at release, level design could be inconsistent, and so on. Thief: The Dark Project and Prey 2017 are near to masterpieces of that genre, but both of them have issues as well, especially Prey with, again, being too easy given the amount of options the player is given (common theme with this sub-genre).
I would agree with aweigh as far as a lot of JRPGs being close to masterpieces, simply because they limit themselves far more than western RPGs in terms of how many mechanics they implement, and thereby are able to focus on perfecting what they do choose to implement. Personally I'd put something like Shin Megami Tensei Nocturne.