I was in a similar situation once. Here's the algorithm I came up with to get myself out:

1. Figure out what you want to do.

This is the most important step. You currently have a job, so you have time to really think about this and figure out a solid answer. The answer doesn't have to be an emotional epiphany where you find your so-called "passion", but it has to be a concrete goal. For me, it was more of a recovery of the idea that I wanted to apply my programming and computer science skills to interesting and difficult real-world problems. With that in mind, I looked at the place I was currently working at, and saw that I wasn't going to be able to achieve my goal there. So, I looked around and found another opportunity that was more along the lines of what I wanted to work on.

2. Figure out what skills you need to pursue your goal.

So, when I found the new job that I wanted, I interviewed for it, and got rejected. I asked for feedback, and I was told that my data structures and algorithms knowledge wasn't good enough. I suppose if I had followed my own advice, I'd have realized this before I applied. After stagnating at my old job, and foolishly taking a team lead position, my skills had certainly atrophied. However, the interview failure was exactly the kind of real feedback/wake up call that I needed.

3. Work on improving your skills so that you are ready to actively pursue your goal.

After failing the interview, and getting some feedback, I set to work rebuilding my data structures and algorithms knowledge. I bought a copy of Cormen, et al., and brought it everywhere. At work, I would go off and hide somewhere for an hour a day, and study some part of the textbook. At home, I worked on a core data structures and algorithms library in C. I'd get up an hour before work, and write unit tests or fix bugs. I'd use the evening to hack on new code for the library. I was pretty exhausted after work, and I had three kids, one of whom was only a few months old, but I pushed myself ahead because I had a goal, and I didn't want to be stuck in my current job any more.

4. Don't give up in the face of failure. Keep the dream alive.

After 5 months of study, and writing the data structures and algorithms library, I decided it was time to apply again for the new job I really wanted. I explained in a cover letter what I had done since the first interview rejection to address the feedback I'd received, why I really wanted to work at the company, and how I thought it lined up with my career goals. Within a week, I had heard back from the company, and scheduled another interview with them. Three weeks later, it was my first day on the job!

It was terrifying to apply for a second time. I had no backup plan. My current job at the time was starting to suck more, and I wasn't enjoying being a team lead, so something was going to have to change, one way or another. My life at home was exhausting, too, with the new baby and two other kids knocking around. But my wife was on board with my whole plan, and tried to give me the time to do the work I needed. It helped that we had friends and family who were struggling to find jobs - there's nothing like seeing other people hurting to give you a realistic perspective on your own life, what you have, and where your life should be going.

On the other side of all this, I've made it my mission to be continuously studying, cramming it in wherever and whenever I can. I never want to be back in that hole of skills atrophy. Also, at the start of every year, I make an assessment of where I'm at goal-wise, and I make a study plan for the year, including a substantial project to work on in my spare time that will help me get to where I think I need to be. Resist the urge to hop from one thing to the next. Focus on something, and master it before moving on to something else.

Good luck!