Well, you cannot return to a sector, so it definitely is gone if you leave.
I do not think loot disappears until you leave the system, because I have done multiple runs to retrieve hundreds of components, and did not notice anything disappearing.
Loot can definitely disappear when you leave the system, and it seems that the rarest it is, the later it disappears. Which is nice.
My guess would be that there is an upper limit on how many components can be floating in space, and when that limit is reached, the game gets rid of some of them. In the perfect world, it would start with the least rare items in the system that was visited the longest time ago. I do not know that it is the case, but I hope it is.
No good deed goes unpunished...