All perfect praise be to Allaah, The Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
It is impermissible to cage an animal whose life is protected by the Sharee'ah and starve it to death. Even if it is an animal that Islam allows to be killed, it should be killed kindly and graciously. It is particularly forbidden to kill ants unless they harm people. Ibn ‘Abbaas said, "The Prophet, sallallaahu ‘alayhi wa sallam, forbade killing four creatures: the ant, the bee, the hoopoe, and the shrike." [Ahmad and Abu Daawood]
The famous story of the woman who was thrown into Hellfire for locking up a cat, to which you referred, indicates the gravity of torturing an animal as well as the enormous sin that it involves.
However, if you did not deliberately intend to kill the ant, then we hope that you bear no sin for it. For more benefit, please refer to fatwa 83830 about the rights of animals in Islam in general.
Allaah knows best.