Without looking at the file, it's a bit hard to tell what's going on, I presume you have a button on the portal line that a user can click on to take it to the related record. I'm guessing that the problem could be a record commit problem...
I would be making sure that this button activates a script, rather that a goto related record.
What you would be best to do is capture the current portal row into a variable, commit the (parent) record, then goto the portal row (by calculation using the variable) and then go to the related record. Why? Because if the parent is not committed, then the child may also not be comitted.
I would also double check to ensure that the target table's layout is the same table of occurance as the one referred to in the portal. I've been stung by this one a few time, especially if there are multiple table occurances of the one table that have similar names. If you goto the related record, using a layout that has no relationship to the parent, this might explain the result.
Thank you for your input. It so happens that it was working fine, but a couple of triggers were affecting the portal on exit, and thus the focus changed to the last row of the portal.