I'm not sure what he did deliver but it sounds more like he owes the company all the money he has been paid so far since he didn't deliver the product. I mean really the nightmare of this all sounds like it is on the side of his employer. He really didn't include enough details though about the original arrangement.
If it was the second one then IMO you really owe them back the initial deposit they gave you depending on what kind of final work you delivered to them. Honestly handing codebases from one developer to another is less than ideal and makes projects more expensive than they should be. Also I'm sure it was way past the expected deadline of the client.
If you delivered nothing in the end then it was really more like they hired a con artist that stole their money, again if you were under the kind of contract I stated above.
If you were a normal employee then you just didn't do a great job due to all the stuff you mentioned.
Either way I don't know why you would publicize a situation like this. It doesn't matter what way you look at it, this whole story doesn't make you sound like a developer that people would want to hire.
Having say that, I know how terrible it is to work on some crappy legacy code and can certainly understand your decision. Good luck!
I've found that pretty much every decision I've come to regret has been made in times when I've been in bad financial situations, and I made the decision primarily based on money reasons.
A couple jobs I've taken turned out to be really bad choices, but I took them because I needed something right then. In one case, the company itself was not good (really dysfunctional team/operations inside) and I didn't feel bad about quitting - the other case, I did feel bad about quitting so soon after starting. The people were nice, but I realized I'd made a bad decision and had to get out.
Having a strong financial base to draw on when you 'go freelance' either due to choice or you get laid off(!) can not be overstated. I used to be relieved if I had a few weeks of living expenses in the bank, and look back now and wonder how I ever survived with that mentality. (Obviously I did!).
shameless plug - http://indieconf.com - the conference for web freelancers - has an open call for speakers. Some of the sessions we've had in the past have focused on freelancer financials and legal issues like the issues raised in the OP post.
tl;dr - It's really hard to make wise/good decisions from a position of financial insecurity. Well... it's hard enough to make wise/good decisions anyway - doing so from a position of insecurity multiplies that difficulty.
EDIT - misread this - the OP hadn't "gone freelance" - had just taken the first job offer that came along. So... not entirely a related plug above, but... the CFP is still open :)
The biggest mistake he made was: "I hadn't took holidays for 2 years at the time". This is really really sad. Normally in France you have at least 5 weeks of vacations a year, but you need to earn them for the next year. So, if you change job each year, you get the vacations paid as money but no free time. It looks like he did just that.
I am really sorry for him, freelancing is hipped all over the place but it is hard to do it well and nearly impossible without good money in the bank to support the bad months.
I wish this site had a rule that content behind a login- or pay-wall wasn't allowed.
Why lucky, you say? Because I had legitimate sick leave for those, and good luck finding and employer who will recognize, empathize and treat your burnout as a regular illness. It usually just spirals out of control until it kills everything around it.
Being a freelancer you get 2 big advantages, you can choose when you take holidays, and you can choose what project you want to work on (it seems to me you failed at taking advantages of either one). Maybe you should have been more direct and say I'm going to take a week off and your project will wait.
What you describe look to me as a typical inexperienced freelancer (don't take it the wrong way, we are all inexperienced when we start) agreeing on deadlines that can't be done, without a good team, and without taking the steps to get a better communication around this company, (your were the lead if I am not mistaken).
You have a lot to think about, a lot to learn from it, try to think at each point of failure and what you would have do different!
But I will agree with the some of the guys here, since this post clearly put you in a bad light, I would not have post it, I would personally remove it.
That said, burnout + having to look for a place in Paris without steady employment, it must have been hard.