This is a very interesting question, and one that would require some substantial research to answer thoroughly. If this happened to you, you should consider contacting an attorney to discuss things in more detail. It's possible you would have a claim or claims of some kind, but without doing some research I can't say for sure.
I doubt you can sue as for money damages. But you might be able to challenge the court's order by having a higher court look at it. See an appeals attorney.
The above is not intended as legal advice. The response does not constitute the creation of an attorney client relationship as this forum does not provide for a confidential communication.
There's really not enough informaiton to respond and a response would depend on more details, suhc as whether a person were on parole or probation (where the sentence is still on going but the offender is being given the privilege of not serving the remining time in jail). or had completed all aspects of their sentence, or even if the person were out on bond (bond can be revoked if there is a reason to believe that the accused may commit another felony). There are those who also complain that having to register on teh sex offender registry for teh remainder of their lives is also beyond the punishment already served and is unconcstitutional - but I believe that has been upheld as the community needs are higher in that instane than those of the offender. If you are concerned, you should definitely speak to an attorney.
This is not intended to be legal advice or create an attorney-client relationship. If more information is needed, you should consult with an attorney in your state regarding the specifics of your situation and the options available to you.