side note: I'm surprised you had a Republic being held by a woman, The Patrician Family succession is supposed to be restricted to Agnatic Seniority. The Grand Mayor (or Doge, if Latin or Byzantine Culture) is then chosen from the Patricians. Not sure how a woman would get into the succession.
You pretty much have to rebuild a Republic from scratch once it's broken. When a Republic stops being a Republic the trade posts all disappear, the family palaces go away, etc. Even if you make the former Grand Mayor the new Grand Mayor he's going to be rebuilding all the Republic exclusives from nothing.
To create a merchant republic
- You need to either A) find a vassal (or sub-vassal) who holds a coastal City as his capital (a Mayor, a Wali, etc.) or B) give a coastal city to an unlanded character.
- Give that person a County, preferably the one his City is in.
- Give that same person a Duchy, preferably one the County is in.
When you grant a Duchy to a person whose capital is a coastal city the game will automatically create a merchant republic. This page gives some handy tips on choosing a good site for a merchant republic and who to put in charge.
If you wanted to be really clever you could try to engineer a line of inheritance to create the Republic. ie. grant a City to the eldest son of an aging Duke then hope the Duke dies (read as: have the Duke killed) and inherits his father's Duchy before his son gains any Feudal titles or dies himself. I'm reasonably certain that would work, but I've never tried it before.