An on-the-run gunman took hostages at a children's birthday party before police swooped to make an arrest.