Well, he was wrong to be putting your code down all the time, I mean he might not have been wrong, it's possible that his criticisms were valid. But even if that is the case he didn't take the appropriate action.
Unfortunately you were also wrong in yelling at him, and not only do two wrongs not make a right citation needed but arguably yours was worse far, far, worse.
Even before you get to the fact that the consultant turned out to be a friend of the head of IT you yelled at a third party, barring some pretty extreme circumstances this is highly unprofessional at least.
Since then, this person has been hired full-time and has been given all the plum projects that I used to get while I've been given bottom-of-the-barrel projects and told to ramp up my skills.
This might not be only down to the..ahem.. incident. Clearly the head of IT rated this consultant and their skills - otherwise they wouldn't have hired them to do consultancy in the first place. Of course it's possible that the consultant's feedback on you has factored in to an extent - clearly they (for whatever reason) didn't rate your technical skills at the very least given the earlier comments. But aside from that you showed yourself up - and made yourself look volatile, childish and unprofessional, and even a dry, emotionless recitation of just the facts is going to look bad.
I've been silently obeying for 4 months but underneath I'm seething.
The word you're looking for is "sulking", and the chances are very good that it's showing. I get it, it sucks to find yourself on the sh#tlist at work, I'd be pretty hacked off too - the problem is that you've been nursing this anger like a precious baby chick for 4 months and at this point it's doing you far more harm than anything else.
Is this a wait-and-see situation, or is this a lost cause and I should see what else is available?
You need to accept two things:
You bear the lion's share of responsibility for your current situation
You need to let this go
And both of these apply whether you want to stay where you are or whether you want to move elsewhere, because if you just change jobs you're not going to remove the common denominator and you'll be just teeing yourself up to repeat this in another form.
Is there anything I can do to get back my good standing in the company?
Instead of seething put that energy into positive things - focus on the work you have, not the work others are getting to do, do the best job you can, ramp up your skills (there's always ways you can get better) and deliver results. It's not a guarantee of success, if only it were that simple! But at the worst case scenario you'll have the knowledge that you genuinely gave it your best and you'll probably have a better, sharper set of skills to take out into the job market.