Kirk's cocky attitude about the reprogram is the saving grace; as somebody pointed out already, he made no attempt to hide the fact.
He didn't feel he was cheating, and that's why there's no sympathy needed at the hearing. It was all out there, as far as he was concerned. He didn't believe in the no-win scenario.
Spock's pulling no punches about George Kirk's no-win scenario was riveting -- and the key to Jim Kirk's motivation. It was a tight, well-done scene; and as soon as the point was made, they had someone interrupt with an urgent message and it was on to another focus.