Highlighting top level link when viewing one of it’s sub-pages, which are not linked in the menu

WordPress already applies the CSS class current-page-ancestor to the <li> if it is a link to a Page that is a parent (or higher) of the current Page. This follows the Page structure, not the menu structure. If this is not fit for your situation, could you edit your question to make it more clear how it differs?