“Heroism” (in the military sense) is performing an action “above and beyond the call of duty.” The Code of Conduct (at the time as well as now), says that a military member should not accept early release, or other preferential treatment. The reasons are fairly obvious and include, but are not limited to, giving the enemy a propaganda advantage.
But the normal construct is wherein the enemy exploits the early release of a more senior person ahead of a more junior person. In the case of LT McCain, the propaganda value of his taking an early release would have been substantially greater, as his father was the supreme military commander of the entire Pacific region. His would not have been a case of any O-3 accepting release ahead of more junior persons, hence the pressure on him, caused by the potential payoff to his captors, was “above and beyond” the norm.
A good analogy would be to compare Lt McCain to CAPT Stockdale, who I believe (but may be mistaken) was selected for promotion to Read Admiral while in captivity. The propaganda value of an admiral-select accepting early release would have been much greater than that of an unknown Lt. And Admiral Stockdale received the Medal of Honor for his actions as a POW, including his refusal to accept early release.
So, yes, Lt McCain was heroic.