It's worth noting, though, that it was JFK's brinkmanship that brought us to the brink.
In 1959, Cuba successfully managed to overthrow its horrendously brutal and corrupt, US-backed, dictator Fulgencio Batista. After receiving no support from the US (in fact, quite the opposite), the new Cuban regime turned to the USSR for help. The US responded with assassination attempts against the Cuban leadership and the failed Bay of Pigs coup attempt (under the JFK administration). Given this, I think it is quite reasonable to argue that Cuba had a good case for needing some serious deterrence against US (including JFK) aggression.
Shortly before the missiles were sent from the USSR, the US had placed similar missiles in Turkey -- only a heartbeat away from key "targets" in the USSR.
JFK's administration was directly responsible for the height of the tensions at the time, by its aggressive attitude towards the newly independent Cuba, its refusal to remove the missiles in Turkey, and, ultimately, for its military blockade of Cuba.
The deal that was made, in the end, was really JFK being forced to back down from this brinkmanship by removing the missiles from Turkey (which he did) and by promising not to try to invade Cuba again (which he also did).
Of course, that's not the story that gets told by the JFK mythologists or the US propaganda machine, who prefer to paint this as a picture of righteous machismo -- making the other side "blink".
Fortunately, the world survived JFK's ill-advised game of chicken, and he had the humanity to not blow us all to bits to have his way.
That doesn't make him a great President, though -- just not the worst leader in human history.