Immediately afterwards, CTRL+Z.
Later, as Chris said, try the history palette.
If you haven’t saved the file, an effective but heavy-handed method is File > Revert (F12), which returns your image to the last saved version.
You CAN un-erase by going to Quick-mask mode, painting where you want to restore,exiting Quick-mask, and running the Filter Factory with A = 255, EXCEPT that if the layer has been erased all the way to 0%, the pixels are set to the background color of that layer, so they’re gone for good. If they’ve only been erased to 1% (or more), you can still save them.
The history Brush will do what you want. You have to take a snapshot of the layer in the History Palette BEFORE you alter or erase the layer.(click the little camera icon at the bottom of the history palette) Then if you set the history brush to use this snapshot(to set, click the space to the left of the snapshot thumbnail at the top of the palette so it shows the little brush icon, don’t click to the right or it will revert your whole layer back to when you took the snapshot)
Now if you erase a part of the image and want to put a bit back if you use the History brush it will paint the pixels back. If you get used to the keyboard shortcuts E for eraser and Y for history you can switch between the two with ease…
Your history snapshots only last as long as you have the file open and won’t be saved so masks are a more permanent way to do this.
It’s a safe bet there are usually at least three different ways of doing the same thing in Photoshop!