Contact a real estate attorney immediately. there were some lawsuits and settlements regarding major banks on this very issue recently. Perhaps your situation involves one of those banks.
The above is not intended to be legal advice, but may be used for general information. Please contact an attorney for specific help tailored to your needs. www.figgardenlaw.com
Yes, you do need to see an attorney and what can be done will depend on the type of foreclosure and the situation.
My guess is that if you didn't pay when you should have you are not going to get to keep the house without paying. You may be able to overturn the foreclosure and perhaps get some relief on the obligation, but in the long run I think you are going to have to do some paying if you want to keep the house.
This comment is general in nature and is not intended as legal advice. It does not create an attorney client relationship and obviously is not confidential. You should contact an attorney in your area who can review with you all of the relevant facts and give you specific legal advice.
Possibly, although is certainly would have been better for your situation to have raised this before the foreclosure. If you intend to pursue this do not let more time pass. Hire an attorney now and proceed.