People can say all sorts of things. Whether you can be sued "for damages" by your employer is a question for a lawyer and depends on your location, situation and contract. By and large, employees are protected from such shenanigans but there can always be loopholes. In my non-legal opinion your boss is blowing hot air because he knows you're underpaid, undervalued and are probably looking to leave.
Even if you like your job, I highly encourage you to start looking for a new job. A boss that threatens you with legal action is a sure sign of a dysfunctional organization where you won't have much of a future. Consult a lawyer or talk to your country/state's employment board about the legal options.
Until you find a new job or if you still want to remain with this company, I suggest talking to your boss about the reason for his threat, as Dawny33 mentioned. That may or may not work if your boss really is a total loon, but there's probably no harm in trying. Open with something like:
I was very surprised to hear that you'd consider putting in a claim for damages if I were to leave. I may have reacted [strongly / with some emotion] but I never considered leaving.1 I'm not looking to do so now either, but can you help me understand why you'd want to sue me? I think we can both agree that I've repeatedly gone above and beyond for this company and I'm a bit taken aback by your reaction.
Have this conversation face-to-face so you can back-pedal or adjust the language if you notice that your boss starts foaming at the mouth. It's important to see his reaction so you can figure out if he's just incompetent and making silly remarks when he feels that his authority is threatened, or if he's now actively hostile towards you. The key point is to assuage his fears that you are leaving. Finding out why he had such an outlandish reaction is secondary as it could just be a sign of irrational thinking.
1 - Note that if you're taking my advice to heart, you'll technically be lying if you say this as you are looking for a new job. This is a situation where your employer has made it impossible for you to be candid about your future plans so your only option is to lie. To be clear, this is one of the only times I'd suggest lying in the workplace.