Error 1015 during downgrade of firmware for Mac OS X

When I turn on the terminal, it just says, "failed to find image" and then logs out. Can someone help me with it? Am I doing anything wrong? I try to restore it from 3.1.3 to 3.1.2 and when the error occurs, I run the terminal but I can't type anything because it just logs me off.
Please help.
