I started a job 8 months ago. The person who did it before was let go for performance issues. Before they chose me they spent 6 months looking for someone (while the previous guy was still there).
I found a total chaos - this was recognized by my boss. The company was missing the basics of my responsibility area. It's clear that the company is somewhat of a unicorn - most companies are much, much further advanced than mine when it comes to my field. (I think that's also a professional risk for me - the experience I'm gaining now will be obsolete at most other companies).
My boss summarized my role several times as that of a "cleaning lady" (after I started - I had no idea what the situation was before) and it was really it. I left no stone unturned. Several months later: I've fixed the main problems and created a clear roadmap for progressing further.
I'm not claiming the situation is "great". It's not. No one would have moved from an utter chaos to excellence in that time and under our conditions, but we are solid: the product quality grew a lot - as evidenced by the no. of issues reported, we even launched some new stuff, which wasn't to be expected, there are no emergencies, firefighting is mostly not needed anymore.
I worked incredible hours. My boss recognized my achievements several times, including in front of larger teams and his boss. Including beginning of this very week: after my presentation of my results, he stressed in front of 20+ people that "I'm too humble" and that I managed to move the area from "a huge disaster" to something functioning well in no time - "incredible achievement".
Just 24 hours later I had my performance review. We have 4 performance grades. I got the second worst one ("Meeting expectations"), with consequences for my yearly bonus and the maximum salary increase I can get this year.
Even worse: my boss didn't say anything positive about me. Instead, I was told I only fixed the basics and there's still a long way to go - he expected me to have implemented advanced projects although when I started the basic prerequisites were missing. My boss said I didn't do anything of impact. He said I wasn't with the company long enough for him to have trust in me and give me a better grade and that I worked too much and he didn't want to reward that. (He made me work so much).
He claimed I didn't deliver several deliverables which I most definitely did deliver (and have emails to prove it).
He also criticized that I solved some technical problems myself, which I shouldn't do as a manager. (I'm an IT manager with a non-technical background. We were facing horrible issues with a tool and had no budget to hire someone to fix them. Discussions about that - my trying to get the money - took months. Business impact was high - I constantly received emails from directors and the board asking when this will start working. At the end I learnt the technology in my unpaid time and solved the problems myself. They haven't reappeared).
At the same time he wants me to finish fixing everything. He proposed to "restart the clock", forget the past and for me to start as if I was completely new. He said the past was "closed" to him and didn't play any role anymore.
But I feel like an idiot for being so committed to trying to fix the disaster. I'm so demotivated I feel like giving my notice now. Can I do anything to still solve the situation or is quitting the only option? Finding a new job that pays the same or better salary won't take me more than 2-3 months, but I have made some good friends at the current job and don't feel like leaving if the situation is salvageable.
Update: I did what some of you recommended: I started documenting things. I wrote an email specifying the feedback I received during my performance review (I should do no overtime, no more jumping in solving technical problems, just delegating, etc.) as diplomatically as I could and stating that I'm eager to adjust to these expectations and that I already took steps to achieve that. I thanked profusely for the feedback.
Afterwards I received plenty of criticism on that from my boss (I'm "not a team player", I "lack communication skills", I don't react constructively to criticism, I should be more positive towards people).