I'd say there are quite a few ways to approach this, and I've at least used a dozen of them myself. Sometimes you can use character and reader ignorance to your advantage. You as the author know everything about your world, your story, and so on. Or at least, you know more than anyone else does. Therefore, you can see the solution presented to your character, while your character and readers remain in the dark about it (maybe catching a few glimpses along the way) until this solution springs to light at the critical point.
One other thing to recognize runs along the same lines of thought. Realize that you have a unique perspective on your story. It's all in your head first. You developed these characters, their world, their magic, or science. You know the angles, and therefore know the potential solutions to a lot of the problems they will face. The reader doesn't. They're learning about your world as they go along with the characters. What may seem old to you by the end of a first draft is a brand-new existence to any one who cracks that first page. So, realize that what you might think of as an "obvious" solution to a problem is only obvious to you because you created the problem and its parameters in the first place. To everyone else, they might be completely flabbergasted by your solution because they never expected that problem to crop up in the first place. Just make sure you approach the problems from both sides and try to see how a solution might appear to someone who isn't anywhere near as knowledgeable about your world as you are.
Other ways to go about it would be realizing what you need for that character to get out, and then subtly weaving those elements back into the story once you realize their absence. Certainly you want to avoid some deux ex machina solution to everything, but making that item or spell or whatever appear to develop naturally through the story instead of a Author-Drop (where something suddenly appears like a gun popping into the character's hand at the right moment) can lessen the feel of cheating.
But I think you pointed out a key element that should almost always be there in these situations. Cost. Sacrifice. Getting out of these crisis involves sacrifice. No character should get away without consequences, or if they seem to, there is something that happens to make their freedom or solution a bad thing. One of their friends gets captured instead. They lose a limb. They lose their soul. Or their power. Or...something.
And there are times when I've just had to sit back and grit my teeth for a few days until I actually figured out how to solve a scene. Maybe there are even weeks where you don't know. All you know is the person gets out of the problem and this happens next. So maybe it's best to leave a few blank spots between paragraphs and continue with the story from where you know it will pick up, while letting your mind mull over potential solutions. Realize that obviously writing a story and the story itself do not occur on the same time continuum. If the character has five minutes, or even an hour to figure out a problem, you can take all the time you need. It will still provide the mental illusion of five minutes or an hour to the reader, and they'll wonder how you, as the author, came up with such a cool solution in that short time, while you're trying to hide your smile.
www.jrvogt.com