The three Taliban attackers and four Afghans were also killed during a fierce gun battle that broke out after the raid.
In a statement the Taliban said it had carried out the attack on the UN because of its involvement in organising Afghanistan's presidential elections, the second round of which is due to be held on November 7.
Ban said however that the UN would continue its work.
"In principle we are not and we should not be deterred by this heinous terrorist attack. We will continue our work, particularly on helping the Afghan government and people carry on this second presidential election," he told reporters.
'Despicable and brutal'
He said the "despicable and brutal" violence seen on Wednesday showed that the difficulties of working in Afghanistan should not be underestimated.
Ban added that in the wake of the attack Hamid Karzai, the Afghan president, had asked the country's interior minister "to provide strengthened security for UN staff."
In Washington the White House also said the attack would not succeed in derailing the planned November 7 runoff vote.
"The administration is confident that there are the appropriate resources to conduct an election," press secretary Robert Gibbs told reporters.
"In Kabul obviously there is an attempt by some to disrupt the will of the Afghan people in choosing their next government that this administration believes will not succeed."
The identities of the UN staff killed in the attack have not been released, although all are assumed to be non-Afghan nationals.
The US embassy has confirmed one of the dead was an American.
The Bekhtar guest house is in central Kabul in an area close to several government ministries that is supposed to be under the highest security.
The guest house is one of several used by the UN in the city which must be given special security approval from the organisation to house its staff.
Following the attack Ban said the UN had ordered an immediate security review and would take measures to strengthen the safety of its premises across Afghanistan.
An internal e-mail to UN staff in Afghanistan said an emergency meeting will be held on Thursday morning to discuss future arrangements and asking all agencies "to review critical, essential and less essential staff lists."
As the stand-off at the guest house came to an end, a mortar attack was launched on a five star hotel, The Serena, also in the capital.
Witnesses reported seeing smoke coming from the top of the building, but the attack did not cause any casualties.
The hotel, close to the presidential palace and used by diplomats and journalists, was the scene of a Taliban attack in 2008 which killed six people.
Kabul has been on high alert as preparations continue for the presidential runoff.
Last week, the Taliban issued a statement calling for a boycott of the election saying they would step up attacks on foreign forces.
The statement warned that anybody involved in running the election would be considered a legitimate target.