Not really. They were hoping that this would not come out before the election. They gambled and lost. Now they pay the price.
Why would they gamble on this when the possibility of losing was very, very great?
This is a safe district and they could have come up with a winner given enough time. Foley could have resigned for something classic such as "to spend more time with his family," and even though this would have come out eventually, only REALLY STUPID people or people who DID NOT KNOW the entire story would manage this crisis this way.