Per the 5
.0 SP1 upgrade guide on page 41 you can get most of what you're looking to do explained ... however there really is no clear explanation (which is disappointing).
That said, I would upgrade BAS first, then upgrade standby, and then lastly upgrade primary.