This is due to the auto configs that emulation station creates for retroarch. I had a similar issue that drove me crazy for hours!
The best way to 'reset' is to go to delete the .cfg file for the controller from the retroarch-joypads config folder (configs/retroarch/all/retroarch-joypads - I think, I'm not in front of my pi at the moment).
You should then be able to remap the joystick via emulation station by going to the config inputs menu (start->Configure inputs). This will recreate the config files.
However, you may find like me that the joystick is still messed up in games, even though it works in emulation station. This is due to a bug in emulation station (or an incompatibility with retroarch, I don't know). I found that 'button' IDs for my joypad in retroarch were different to the button ids regognised in retroarch! E.g., input_btn_a had an id of 1 in emulationstation, but retroarch regognised it as id 8. So the auto-config created by emulationstation was totally wrong, and lead to different button presses in games!
I solved this by manually updating the relevant cfg file in the retroarch-joypads folder. I found that all my button Ids were out by a value of 7. Some trial and error is needed though. I found it easiest to use the retroach GUI (RGUI) to identify the button ids by binding the controller via RGUI and then noting which button ID each button showed up as. Note that whatever you bind n RGUI will be overwritten by the cfg file in the retroarch-joypads folder, which is why you need to update the file in there.
I hope that helps get you on the right track!