The prime minister was caught on camera talking to former New York mayor Michael Bloomberg.
He said: "The definition of relief is being the prime minister of the United Kingdom and ringing up the Queen and saying, 'It's alright, it's OK.' That was something. She purred down the line."
After saying something that wasn't clear, he added: "But it should never have been that close."
The prime minister is currently in New York for a UN conference on climate change. As he continued to walk with Bloomberg, he said: "I've said I wan't to find these polling companies and I want to sue them for my stomach ulcers because of what they put me through.
"It was very nervous moments."