Have you checked electrical connections? Battery terminals and ground connections?
The fact that your lights where flickering sounds like an electrical fault and the fault codes might be caused by this. Lose connections can cause alot of heat, this might explain why the rest allowed it to start again.
Where did you get the fault codes from?