I have to admit it's one of my guilty pleasures -- an interesting and entertaining juxtaposition of someone doing the wrong things for the right reasons (breaking the law to protect taxpayers and get the bad guys) and someone doing the right things for the wrong reason (trying to bust a corrupt cop for purely political gain). It's a classic examination of whether ends justify means -- Machiavelli would have been proud.
I don't see it glorifying the "guilty until proven innocent" mindset. It exposes the issue and that juxtaposition for debate. The world, unfortunately, isn't a black & white place where the good are always stalwart and true and the evil can be easily identified by their black hats and dastardly mustaches.
The main character could hardly be described as heroic nor his corruption sniffing captain as villanous. We're seeing the toll it's taking on the protagonist (Mackey?) and we've seen the captain cross the line by implicitly approving police brutality. So they both recognize that there's a line between good and bad, right and wrong. They disagree on when it's appropriate to cross it. And how far to cross it.
BTW, it's a TV show, not a documentary and hardly is evidence (in either direction) to trust or distrust cops.
As far as the gay cop goes, I'm not sure where they think they're going with that story line. But that's why I only watch it afterwards on my VCR and fast forward through those scenes.