From what I understand, when you allow your body to go out of ketosis, it takes 3 days to get back in - just like when you started the program. In order to have the best results, it's best not to go in and out of ketosis. You won't be able to rest and heal your pancreas.
Try to fight through the headaches - make sure you're getting your water and salt.
Keep going, you can do it!