This fix worked for me, but I had to do it TWICE. You may need to do it more than once as well. I think it has to do with the particular hex code for certain guards (male/female).
Here is the Markarth Guard fix:
- Walk up to a guard
- When the guard says, "You've committed crimes against Markarth," DO NOT choose any options.
- With the dialog waiting, press the tilde key (~) to open the command console.
- Click on the guard's HEAD (note: must be HEAD!) and you will see a hex code on the screen.
- Type: paycrimegold and hit enter.
- You will be teleported to a new, random location in Markarth.
- Press the tilde (~) key again (this will exit the command console).
- IF YOU ARE ATTACKED, keep looking around for a guard to question you then repeat the steps above.
- UPDATE NOTE: If this doesn't stop some guards from attacking on spot, try this:
- Press the tilde key
- Type: setstage MS02 250 and hit enter
- This should set the game to the "Thonar has granted me pardon" though no actual on-screen message will appear.
Hope this helps someone out there. I found the original info on Neoseeker or some other forum, but it did not say anything about possibly doing it more than once.
**Disclaimer: there a LOT of things you can do inside the command console. What you do in there is on your own head, not mine!