Fixing stuff that doesn't work can be exhausting. It can be draining. It can be discouraging. More so if you thought they were fixed and after a couple of hours they come back to bite your butt. It objectively sucks. It does. So, how can you do to not lose your mind when stuff like this happens? How not to obsess like Walter White with that fly on that episode?
The first thing you have to ask yourself is: can you fix the problem by yourself? Are you just lacking certain tool or piece of knowledge that, if acquired, you would be able to solve the issue without any further help? Or is it beyond you and your abilities? Sometimes the problem is persistent and present (see the alliteration?), just because you are too proud to ask for help. And I get that sometimes it might be a budget issue what prevents you to ask for help, but if you can't solve it and you can't move on, might as well spend some money and continue with your life —and your project—, instead of losing days (weeks even) of sleep and motivation in a task that maybe is not for you to fix and that might put a stop to the whole operation.
The next thing would be if you can work around the trouble. Can you get something going while someone else fixes what's not working? Can you do some other stuff while on schedule and maybe later in the day solve the issue? If you have something else to put your head into, you won't be beating it against the wall as result of your frustration. So try to look for other —several, if possible— activities to do in order to avoid obsessing over ONE particular thing.
What about moving away from the problem for a couple of hours or a day? It could be that all you need is a little perspective and a fresh and rested brain to focus again on fixing whatever is bugging you. Go have some coffee —or a beer actually, you should relax—, catch up on some episodes of that tv-series you said you would watch but you never did because you were too busy working, get some sleep. A burnout head won't work to solve anything, so if you really commit to resting for a while, you might find out that the problem was actually not that cryptic and unsolvable. But also, maybe it still can be. If so, don't panic, or try to at least.
So you used all your resources and it's still there. You did everything you could and: nothing. Asked for help to your genius friend and still couldn't figure it out. What then? You feel the stress and anxiety rising through your body like temperature on a thermometer.
The only thing you can do is keep going.
You ask your friend to help you look out for someone else that might know. You might have to start looking for the origin of the problem a little deeper than before. You eventually make it work. Because that's what we do. We invent wheels out of rocks, we figure out how to fly for hours, we go to space and have our cellphone signals do the same. We eventually figure out what is wrong with a software development project. We just keep going.