The pair surprised a Broadway audience while singing one of the boyband's biggest hits.