The woman had come to the Osmania hospital on Sunday with severe breathing problems. She had no one with her but the child.
It turned out that she was suffering from severe cardiac problems and the doctors had been unable to help her. As she lay battling for her life, the child climbed on the bed and curled up beside her.
Even when the woman died, he slept on, oblivious of his loss.
When the attendants woke him up, the five-year-old refused to be separated from his mother. A search then started for the rest of his family.
Sameena Sultana was found to be a 36-year-old single mother from Katedan, an industrial area in Hyderabad. Her husband Ayub had reportedly deserted her three years ago.
After a call from the hospital, a non-profit, the Helping Hand Foundation, pitched in to track down the boy's extended family. Following an 18-hour search, the Mailardevpally police finally traced the relatives of the woman to a village in Zaheerabad, the non-profit said in a Facebook post.
The boy was handed over to his uncle who has promised to take care of him.