I once ran a 5k XC race that went similar to what you described. The course started out flat for 1.3 miles or so and then got into some insane hills that were probably past 45 degrees in some places. I ran a strong first mile, in the top 30 runners or so, but then I went over a few of those hills and they crushed me. It seemed like every step there was more fire in my quads, and I ended up walking for a few seconds multiple times.
I finished with a 21:58, about halfway through the 170-man field. My first mile probably had me on pace for a 20:30 or so. That was the last race of last XC season. I am in much better shape now and my track season has been going well (one win, one second place finish) so far, but I still feel awful about it.
Short answer: Don't walk. You will regret it. Like, a lot.