The incident took place at 1:30 am - an hour after the building was evacuated.
At least five to six persons were feared trapped in the rubble, said a police official. Rescue operations were underway.
The incident occurred on Friday night in the Shantinagar area when the residents of the building were being evacuated by the fire brigade and the municipal agencies.
The residents had reported that the building was shaking. Eight families were living in the building.
The tragedy could have been much worse had the families residing in the residential complex not been moved out in time after cracks were spotted in it late Friday night, an official said.
"However, even after the evacuation, some residents returned to the building, after which it collapsed around 1.30 am. Two persons died in the crash and their bodies were recovered from the debris," he added.
The deceased were identified as Shiraz Ansari (26) and Mohammad Akib Shaikh (27), the official said.
"The building named 'Manahara', located at Pirani Pada in Shantinagar area, was very old and dilapidated. On Friday night, some residents noticed cracks in the structure, following which evacuation process was initiated post midnight," chief of Regional Disaster Management Cell (RDMC) of Thane Municipal Corporation (TMC) Santosh Kadam said.
After being alerted about the building crash, personnel of the National Disaster Response Force (NDRF), Thane Disaster Response Force (TDRF), fire brigade and others launched a rescue operation.
Work of clearing the debris is still on and some more people are feared to be trapped, Kadam said.
"Five persons, including two firemen, were injured in the incident and they were admitted to a local hospital," he added.
(inputs from agencies)