Residents were left stranded overnight after a 10-storey building partially collapsed, forcing more than 50 people to evacuate.