He actually didn't lock her in the "darkest, foulest, most pestilent underground dungeon." His only failing in his treatment of Phthia was trusting his son; perhaps not the wisest course of action, but still not exactly something you can lambast him for, particularly while he's reeling from the death of his beloved wife.
And as I said, yes, in one version of the story, he's an asshole who leaves her to die. In another version of the story, he's so grief-stricken at not being able to find her after Dinoysus abducts her, despite scouring the island for days, that when he sails home he forgets to change the color of his sails from black to white (which costs him his father's life as well). Theseus is about the only hero whose story can be assembled from start to finish as "legitimately decent human being" if you pick the right version. (Odysseus is a close second, but there's no getting around that whole "sleep with two or three hot chicks on the way but expect my wife to be perfectly faithful" business).