What everyone else said...
My son turned three a month before my surgery. We explained that daddy was going to the hospital to have his heart fixed. We told him that I was very sick and that the doctors in Cleveland (He knew where we were and had been there when I was first evaluated by the folks at CCF, though he never actually saw the hospital)
We also explained that I would be gone for a while, at the time we had no idea how long that would really be!!!
We bought a little photo album and took polaroids of mommy, daddy, papa, and our two cats. I also made a small drawing of Tigger for him and we took one photo of me holding him upside-down (mind you, I was in SEVERE CHF at that point, bull-headed too!)
At the time we assumed it would be about a week or so. Our son would stay with his grandparents and their four kids and he just loves being with them.
What became hard was explaining to him that I was "sleeping" after the surgery when I spent five weeks on the vent. he really wanted to go home and that's all I heard when I was finally able to speak to him over the phone from my hospital bed. That was really tough for all of us.
When I got home though, everything was all better. He still loves the "novelty" of my ticking heart and he shows it off to his preschool buddies. They have a few old style stethescopes in the class to play with and every once in a while I have the whole group of kids taking turns listening to my heart, trying to figure out what's going on, why mine sounds different from everyone else's.... =)
Be frank, straight forward. You don't need to go into grand detail, just tell him that you're going to have an operation to make your heart work better. it may be a little while before you get home (hopefully sooner rather than later) and when you do get home he needs to go easy with you for a while as you heal up. That was one of the big things we stressed with my kid before surgery, not hitting my chest. He likes to do that to people and we knew that he just couldn't with me for a LONG time. He still tries on occassion but I block him fairly well.
Doctor's are gonna make my heart work better because it's not working very well now. it's going to take some time for me to heal, but I'll be stronger and feeling better real soon after I come home. I'll be away for a while so I can come back and play more with you than I do now... That works well if you haven't been able to play as much as you used to because of your heart.
Simple terms that little kids understand.
Answer their questions, but don't volunteer information beyond the very basic, "I'm going to have an operation to fix my heart" kind of stuff.
By the way, I'm not sure kids really think of parents or other family members dying unless they've already experienced it or they're much older, 8-10 or more... You probably won't have to cover that "possibility" with them unless they bring it up and it's best NOT to get into that yourself.