That's too bad about his heart surgery. Always scary on an infant . . . well, anyone. So, this is your boyfriend's child? Are you bio mom or step mom? Asking because that makes a bit of difference with regards to the power you'll probably have over the situation. If you are step mom, how does your boyfriend feel about it? If he is on board to help change the behavior, that is SO much easier. It takes at least 3 weeks to change behavior habits and remember, he's having these out of control tyrant seeming moments for one of two reasons (or both). 1. He may have issues with communication. When a child has had a trauma in infancy, it does do some damage to them. They are in pain, they are handled differently than a typical child, etc. He may have missed some valuable learning time. Sounds weird because he was a baby but how is his speech, how is his ability in general to handle frustration, disappointment and anger? For kids like this, they need gentle teaching, role playing with things they CAN do and things they can't do, to be given the appropriate language to express through words verses reactions. The other reason 4 year olds behave this way is it works. :>) Squeaky wheel gets the oil and all that. Are the people in his life like dad, extended family and siblings all calm sorts?
Tell us some specifics when his behavior is out of control and we'll dig deeper to try to help!
Since you said, "lately he has been out of control" ....I was going to ask you if there had been any changes in his life. And you answered that. Surgery at that age is super scary and I think that is at least part of what is driving it.
The ability to communicate and express feelings is so important. If he can not express how he is feeling...what you get is what he does.
However, there are ways to give directions. Make sure he is looking at you. Get eye contact. Give the direction and then say you have till I count 5 to follow. Then give a very short time out if he does not. and repeat and repeat and repeat. As Specialmom says, it can take up to 3 weeks of constant repetition to see a change.
Also, getting him to communicate his feelings. There are several very good books in the series "The way I feel" that are aimed at his age group and meant to be read to the child many times and practiced. They give the kids a vocabulary and a means to deal with emotions. A good example is in this link and other very good ones are also noted. They will help and the bonding of reading to him at night is also very good. The link is....