Set him down and apologize.Explain to him that it wasn't his fault that you got angry.Be honest.Tell him anger is an emotion,like sadness.Use this time to explain that it's ok to get angry,but that you didn't control it in a way you should have and that it hurts others around you when acting out that way.Tell him grownups have problems controlling this as well.
Use this as an example of what not to do.
Mine are 15 and 16, and for several years now, I've found that if I do like Marble suggests - open up to them and tell them what's real, and apologize when that's right - that works very well. They understand if you explain it.
Your bigger question - will the kids ever understand all the issues - is harder to say. They may not understand it the way you do; they are different people and may view some aspects differently.
My S15 and D16 seem able to see what's real, and understand what I tell them, and still love their BPD mom. I had them in counseling for a few years and I think that helped, and I've been in counseling too, and learned here and other ways how to talk openly with them, and I think that works.
My stepkids (23 and 35) were both raised by their BPD mom before we got married, and they struggle more with these issues. SD23 tends to take her mom's side and pretend that things are different than they really are. SS35 I think sees things as they are, but still clings to a fantasy about his "family" - he doesn't really deal with what happened when he was little, and that holds him back from dealing with some important issues.
I think your kids and my younger kids will probably be OK if we handle things skillfully... .