That's what I thought... I guess we would just have to customize the UBE to generate a URL based on run-time variables or create a business function which can create a URL based on parameters and pointing to the archived invoice file. And then update the Sales Order attachment Media Object record in F00165 with the URL.
Yes, that is the direction I was thinking off indeed. The final solution would depend of course on the use case scenario in question and your final requirements.
Good luck, sounds like an interesting thing to do. Let us know your results.