Perhaps I'm taking the OP too literally at his word, but my first inclination is to see it like this: an undergraduate tried his hand at research, had a predominantly negative experience, and now is not motivated to continue even though his advisor gave him something else to do. Well, there is one obvious answer: don't continue with your research if you don't want to. Whenever an undergraduate is doing mathematical research (TCS research counts), they are doing it for the purpose of getting a sense of whether they like it and want to continue with it more than any other purpose. So if you feel strongly enough that you don't like it, it may well be that in fact you achieved what you were supposed to achieve in a fundamentally deeper sense than the one you are feeling bad about. Most undergraduates doing mathematical research decide at some point that it is not really for them, at which point they stop.
To be honest, my experience with undergraduates doing mathematical research is that they are often rather fickle and flighty in their approach when viewed through the lens of a professional researcher. I have spent hours, days or more trying to give undergraduates the training they need to work on a problem that I've chosen for them, only to hear from them next week that they are now interested in something entirely different, e.g. some pattern they saw in the numerical output of some code that they wrote. Whether that is disappointing depends entirely on my expectations. I now think that treating an undergraduate as a "non-positive year graduate student" is the wrong approach: in particular they should not be assigned a problem that one would expect an older student or researcher to spend several months working on. Certainly they should not be given a problem such that a failure to solve it -- or even a complete neglect of it -- will have a significant negative impact on their advisor or anyone else.
Circling back to the situation: I worry that the OP has been placed in a situation which is "too serious" for an undergraduate student. A little context is missing; e.g., the OP writes
I have been working as an undergraduate researcher in theoretical computer science for 7 months.
Does that just mean that you've been thinking about TCS for 7 months? Are you getting paid to do it? (Most undergraduates in the US are not paid for academic work they do during the academic year...but the OP may well not be in the US.) Are you getting paid as a sort of undergraduate research assistant to your advisor?
There are some nuances in the situation that make it hard for me to read. On the one hand, it's possible that your supervisor is doing a bang-up job: he gave you a problem that you were interested enough to work on for several months (already a successful undergraduate research experience, I claim). You claimed to solve a piece of it, which is nice for you but not necessarily something that needed to be written up. Then your advisor discovered that there actually was interest in what you had done, and was involved in the process of discovering a mistake in your writeup. After that happened twice, he stepped in by sketching an approach of his own. That sounds really supportive to me. (I'm sorry that you put a lot of work into a writeup that he didn't comment on in detail, but: I've been on both sides of that situation. It happens, too often, to good people.) On the other hand, if your advisor actually expects you to function as someone who can mostly carry him through achieving his own research goals: when it comes to mathematical research, at least, that's very bad. At the most you have a short internship as a mathematical researcher: it's his career, and the burden of responsibility needs to fall on him in every way. If you are feeling bad because you think that you've derailed his own research plans or otherwise disappointed him: well, I think that's very poor behavior on his part.
To end, perhaps you should embrace the fickleness of undergraduate research. Not feeling excited about the project? Don't work on it...for now. If there is something else that interests you, anything else, look at that instead, and talk to your supervisor about that if you choose. It may well be that you could regain your positive feelings about TCS research by thinking about -- well, anything -- and when that occurs and/or some time has passed, you may actually enjoy returning to the problem and proposed solution your supervisor gave you. (A big secret: I am a real life research mathematician, and giving up on something that isn't going well for a little while in order to regain enjoyment and confidence is something that I do very often. Sometimes there is exactly one hard problem that I want to chip away at for days, weeks and months at a time...but more often, there isn't, and sometimes I wonder a bit at how hard people who only work on one thing are actually working.) Or not, which (according to me!) is really okay.
Final word: don't do mathematical research if you don't enjoy it. Seriously.
Added: I am concerned that my "final word" is not being understood as I meant it. First of all, an equivalent version is "If you don't enjoy mathematical research, then don't do mathematical research." Maybe this stops people from reading this as "don't do mathematical research [plus other words]"! Second, the statement has to be construed in a reasonable way, and in fact anyone who is doing mathematical research has to construe it in a reasonable way for them. Certainly I don't mean "If you wake up one (or two, or three...) days and have negative feelings about mathematical research -- or if you have one (or two, or three...) setbacks in your mathematical research -- then you're not cut out for it; just stop now"! What I mean is "The main reason that people do mathematical research is because of the joy and sense of personal fulfillment it gives them -- not that it always makes them happy and fulfilled, but that in choosing which of the many things to do with their life, this choice seems to make them more happy and fulfilled than the alternatives." There are extrinsic rewards to mathematical research as well -- if you are successful enough at it, you make more than enough money to survive, you have more control of your daily schedule than many other professionals, there are many opportunities for travel, and so forth -- but if you remove the intrinsic rewards, the extrinsic rewards don't stack up against other careers that a similarly talented, hard-working person could probably achieve. Also not enjoying mathematics is not a failure and is not the same as being bad at it. It almost seems silly to have to say this out loud, but: the people who do mathematical research as a career are not the ones who in all the world are the most talented or most successful at mathematics -- they are the ones who are talented and successful enough to get paid to do it and who value the activity enough to devote their lives to it. Most undergraduates who do some mathematical research do not want to devote their lives to it. That's not a character flaw or an intellectual weakness on their parts: there are just a lot of other valuable things to do. Finally, I'm not saying "Look, most undergraduates quit, so you'll probably quit." I'm saying "Most undergraduates quit, so the idea that you might quit should not be so horrific that you can't even contemplate it." All things in moderation: if you have a bad experience with something, taking a small break from it, reassessing your commitment to it, adjusting your practice of it to rekindle your joy are all reasonable, healthy responses. So is powering through the pain, sometimes. These are all good things for us to have in our repertoire.