In this way she also retained control over the vast Rákóczi estates, which included among them the castles of Regéc, Sárospatak, Makovica, and Munkács. In 1682 she married Imre Thököly and became an active partner in her second husband's Kuruc uprising against the Habsburgs. After their defeat at the 1683 Battle of Vienna, both the Ottoman forces and Thököly's allied Kuruc fighters had no choice but to retreat, and Thököly quickly lost one Rákóczi castle after another. At the end of 1685, the Imperial army surrounded the last remaining stronghold, Palanok Castle in Munkács. Ilona Zrínyi alone defended the castle for three years (1685–1688) against the forces of General Antonio Caraffa. After the recapture of Buda, the situation became untenable, and on 17 January 1688, Ilona had no choice but to surrender the castle, with the understanding that the defenders would receive amnesty from the Emperor, and that the Rákóczi estates would remain in her children's name. Under this agreement, she and her children traveled immediately to Vienna, where in violation of the pact the children were taken from her. Ilona lived until 1691 in the convent of the Ursulines, where her daughter Julianna was also raised. Her son Francis was immediately taken to the Jesuit school in Neuhaus. At the time, her husband, Thököly, was still fighting with his Kuruc rebels against the Habsburg army in Upper Hungary. When Habsburg General Heisler was captured by Thököly, a prisoner exchange was arranged, and Ilona joined her husband in Transylvania. In 1699, however, after the Treaty of Karlowitz was signed, both spouses, having found themselves on the losing side, had to go into exile in the Ottoman Empire. The countess lived in Galata, district of Constantinople, and later in Izmit, where she died on 18 February 1703. She was buried in the French church of Saint Benoit in Galata. From her first marriage with Francis Rákóczi, Ilona had three children:  From her second marriage with Imre Thököly, Ilona had three children, all of whom died at a young age (including one she was pregnant with during the siege of Munkács).