Having relations during the seven clean days means you have to wait to resume counting the seven days, but does not cancel the complete clean days counted prior to the incident and does not affect the obligation to immerse in the mikveh.
When a couple has had relations during the seven clean days, the day of the relations and the following three days cannot count as clean days. Once four days (including the day on which relations took place) have passed, the wife continues to count the clean days where she left off in her count and immerses after completing seven clean days. Even during the waiting days, she should continue to perform bedikot. The wife can and should immerse the night following her new day seven.
For example: A woman performs her hefsek taharah on Sunday afternoon. She and her husband unfortunately have relations on Tuesday night. Monday and Tuesday still count as her first two clean days. She cannot count the four days from Wednesday through Shabbat as clean days. (Halachically, Wednesday is considered the day of relations, since days are measured from sunset to sunset.) Sunday is thus her third clean day. She immerses on Thursday night.
Although having relations during the clean days is a serious error, it does not invalidate all of the couple's efforts to keep these laws of niddah this cycle. Until the wife immerses, any act of relations is prohibited, no matter what has passed during the interval.
While they wait, the couple has the opportunity to discuss the best way to avoid this situation in the future. The laws of harchakot, though they may seem daunting, are designed largely to help with this. The couple should also perform acts of teshuvah (repentance), such as prayer and giving charity.