There's nothing you can do make this slow, under-performing employee to like you. You're making him look bad by virtue of simply doing your work well, and this is, indeed, probably going to cost him his job.
And there is no reason whatsoever for you to feel bad about this. The guy made his bed, and now he'll have to sleep in it.
You should certainly keep doing what you're doing, because you're clearly getting positive results. Him getting fired is going to be a direct result of his own work ethic and attitude, so there's nothing you can do to change that short of sabotaging your own work. Don't do that.
What I'd like to warn you against is being too passive about this guy's attitude toward you and your work.
I disagree with @dan1111 in that sometimes letting your work speak for itself is not enough. Visibility and office politics both play a huge role in how people perceive your work.
My personal approach to someone badmouthing me would be a conversation in which I would establish that I don't appreciate his attitude, and also point out that I have a paper trail of him asking me for those features, possibly followed by a meeting with the manager if his behavior persists.
Take proactive measures to maintain a good reputation. Far too many of the questions we get here are from people who let a situation such as this get out of hand, and want to know how they might set the story straight with their managers (they typically can't at that point).
Edit based on OP's comment:
Defending yourself in a meeting while not appearing overly confrontational, or aggressive is always tricky. There's no one guaranteed successful approach; it will depend a bit on the company culture, your relationship with your bosses, etc.
However, I can offer a few pointers. Always remain friendly, cooperative, and calm. For example, if he criticizes something he previously agreed to you may wish to answer in a seemingly humble way, while highlighting his involvement in the decision:
"I'm sorry you don't like this approach. I'm a bit confused as to why you've changed your mind since our last conversation though. I thought you were happy with this solution. What caused you to change your mind?" (remain very friendly, and "genuinely curious" as you say this)
You want to avoid straight up saying "You're an idiot/liar", but you also want to make sure to put him in his place firmly, while appearing polite and cooperative. As you've mentioned, the managers are not technical people. Make sure to use terminology which makes you appear more technologically informed, while keeping in mind what their own interests are (fast webpages which work well and don't hog server resources because it's expensive to upgrade those)
Him: Why did you implement feature X this way? This is terrible, it's a horrible approach! You should have done my way, bla bla bla
You: I'm following X methodology, which was specifically designed to work with the latest features in version 2.1 of JavaScript and JQuery. I think I know what you're trying to say, but that approach has been obsolete for at least 2 years now, as it was less responsive, and hogged more server resources. I think we can all agree that we want our web applications to perform as efficiently as possible. (what's he going to say at that point? No, I don't want that?)
Him: No, you're wrong, bla bla bla
You: Bob, please don't take my word for it. There's some excellent articles on this topic on several prominent tech blogs and websites! I can recommend a few, and we can discuss this after you've done some research :-) (he comes across as uninformed, and as an asshole, while you're on the ball, and sharing knowledge - a real team player)
What you have to remember is that a non-technical crowd won't understand why a certain piece of code is bad in the same way that a skilled develop will. We can look a system's code and immediately judge whether the person who wrote it understood what they were doing or not. Management can't - they judge the functionality of the final product. What you say to defend yourself might not sound entirely valid, or relevant to a programmer (code executes really quickly, using one approach over another may not make your methodology significantly better from that point of view), however to a layman it will sound like you're a technical God, while the other guy is whiny, and behind-the-times.
If you can give me some examples of things he's said to try and place the blame on you I can try and think up some other "comebacks". Ultimately, however, you may want to have a sit down with one of the managers and say something along these lines:
Hey boss. I have something very important I want to bring up, and yet a I feel a little uncomfortable saying it. Bob's attitude toward me and my work is starting to concern me. I've tried to explain my approach, share my knowledge, and involve him in the development process, however, as I'm sure you've noticed in meetings, he seems to go out of his way to attack my work. I love getting feedback, however I don't think his comments stem from a genuine desire to help the project improve.
Note: If you're not comfortable with the wording simply come up with your own way in which to express those general ideas. Also try Googling articles on the subject before your meeting tomorrow. You don't need to necessarily go out of your way to make the guy look bad, you simply need to defend yourself when he speaks up against you.