Are you using a good enzyme cleaner to clean up his accidents upstairs, like Urine off? Maybe he can still smell his accidents so goes back to continue marking. As far as the cat's go, I can't help you there. I would say to exercise him a lot but it seems like you are doing that. Could be his herding instinct or just a way he is playing. Hopefully someone else can chime in on that one.
Use a good cleaner (I agree on Urine Off) and take him out more often. To stop both the peeing and chasing the cats you must have better control of him in the house. Dragging a leash for a while will give you that control. Never allow chasing the cats with out a firm no and if he still focuses on them attach the leash to you for a day or two. This will help you control him and teach him that you are the boss. It is surprisingly bonding! I have trained puppies as well as adult dogs to leave the cats alone using this method and have cats that will cuddle with the dogs because they know they are safe.
Lemmy is the same age and has the occasional one also. It takes a year for a puppy to be fully potty trained. He has them when I either a. Don't respond to his signalling fast enough or b. when he's to busy having fun to want to stop and go outside.
Pilot had the occasional accident right up to 12 months.
I would reduce the amount of freedom he has if he's still having accidents. Babygate off the stairs so he can't go up there unless you're watching him. I second the suggestion of the leash on him in the house, it's probably the best way to correct him quickly with the cats.