Let me put it this way - yes, they overpaid. Giving up all five, that's dumb, unless they obtained a lot more in secret clauses than just Bergdahl (and honestly, I don't even really trust the Taliban to adhere to public clauses, never mind secret ones).
But giving up one or two now would've been fine, preferably the ones not implicated in massacres of Afghan civilians, and then the rest later in the course of negotiations, with the agreement of the Afghan government. Sooner or later they were always going to let them go, which I think is how it should be. That Gates was against doing so during his tenure isn't a surprise, but then at the time there was still much more of an American presence in Afghanistan.