I love this question! Time outs don't work on all children. Some behavioral experts advise that a time out shouldn't be used as a punishment, but rather as a period in which an upset/angry/grabbing child can get his impulses under control. When used that way, a time out isn't an automatic minute-per-year, but rather whatever time it takes, often with a calm, supportive, and friendly parent sitting nearby.
Putting a child repeatedly in time out for repeated hitting would tend to numb the effect – it would simply become the child's life (hit = time out; hit = time out; hit = time out; not much time to experience or practice anything else).
Immediate and logical consequences tend to work best with younger kids. Your "sad/ouch" reaction would work for some kids, but since it isn't with your little guy (he might actually like your reaction if he's mad at you), try two other things instead.
First, if you know he's in a situation where he's likely to hit, "shadow" his activity and intercept the hits as often as possible. Or immediately after they happen. Hold his hand (or arms) down firmly but gently. Tell him "No hitting!" in a kind voice. Use his hand to stroke you or the intended victim and say things like "Touch nicely," or "Be gentle."
Second, and even more importantly, recognize that he has legitimate needs of his own that make perfect sense to him. I'm glad you recognize that he needs time to make a transition. But you may need to talk up the change a bit more. You can get down to his level and participate in whatever he's doing for a moment, while you describe what's coming next. Make it sound desirable (stimulating, comforting, playful, delicious). Remind him how much he likes to play with his pirate, for example, who's waiting for him in the bathroom. Or help him clear the dinosaurs out of the way so you can get to the bathtub (my grandboy has loved that game for two whole years).
Then if he still resists when it's time to change, empathize with him sincerely. Often kids are not convinced that grownups recognize how important their lives are to them, as they get manipulated and scheduled away from one interesting activity after another. And much of their resistance simply melts away if you just help him express his frustration whole-heartedly. "I know you want to play some more! I wish you could do that all night long! We'll come back and do it again tomorrow, okay? Right now, let's go have dinner/bath/whatever."
This may sound rather effortful, Michelle, but it is really no more so that the aggravation you're dealing with now. It comes easily with a little practice. If you'd like to see a master of empathy and redirection, google The Happiest Toddler on the Block, and watch a few short videos of Dr. Harvey Karp winning the imagination and emotions of one child after another.