Mark was married to Sarah, but Sarah had an affair with Greg and conceived a child with him. Sarah lied about the paternity of the child claiming it was Mark's. Mark went to jail for a crime. During his time in jail, Sarah divorced him and married Greg. Greg filed a suit for paternity of the child; and a blood test indicated the child was his; plus both Greg and Sarah testified that the child was indeed his.
Here's where you lose me. If Sarah and Greg marry, why doesn't Greg just adopt the child rather than "claim paternity?" From a practical standpoint, it would make more sense for Greg to adopt the kid and then arrange for a private DNA test that proves that he's the father. As I pointed out before, a court would not permit a third-party to claim to be the father of a child born in wedlock. On the other hand, it is quite common for the new husband to adopt the old husband's kids -- no doubt Sarah got custody once Mark went to jail, if she hadn't already been granted custody in the divorce, and it wouldn't be uncommon for a court to approve an adoption when the ex-husband is a convict. And once he is the adoptive father, Greg can arrange for that private DNA test, so that he can tell the whole world that, not only is he the adoptive father, he's the biological father too. That also avoids the next problem...
Mark was removed as the father though not by choice; he fought to remain the legal father of the child. Later Sarah broke up with Greg, and Greg died of an accident. If Sarah reversed her statement (possibly claiming she had not had sex with Greg during the time she had conceived the child), could Mark regain paternity?
See, here's the deal: if Sarah testifies that Greg is the father, and then later testifies that Greg isn't the father, she's admitting that she committed perjury the first time around. That's a problem. Furthermore, courts are very reluctant to let witnesses recant prior testimony. There just aren't many opportunities for testimonial "do-overs." If Sarah says "what I said before wasn't true," a court is likely to respond: "well, she was either lying before or she's lying now, but in either case she's a liar, and we shouldn't believe anything she says."
Now, the question that I have is: does Mark remarry Sarah after Greg's death? If he does , then it's not much of a stretch to have Mark regain his parental rights. All he'd have to do is arrange for an adoption. Under my scenario, the DNA test was private, so there's no reason to go to court to reestablish paternity. Mark's paternity (as opposed to parenthood) was never lost, since the law continues to assume that he's the biological father.
If Mark doesn't remarry Sarah, then that complicates things. He can't adopt the child, because he's not married to the child's mother. He could arrange his own private DNA test, but that wouldn't do him much good, because he's not actually the biological father. If Sarah wants Mark to be deemed the biological father, she could surreptitiously slip some of Greg's biological material into the test tube in place of Mark's (the details of that operation I'll leave to your imagination), so that the test "proves" that Mark is the father.