This is an excellent question, and helps illuminate several important aspects of the way perception works in aviation. But first...
Any near-miss or other air-proximity incident would have been reported
If there had been any risk of a collision, it would have been reported, unless somehow (and this is astoundingly unlikely) the entire flight crew of both aircraft were entirely piratical.
But flight crews are not swashbuckling daredevils; they do everything by the book, because that's what keeps them alive to fly another day, and because everything in their training and professional discipline is about following procedures correctly.
Even if there were not a risk of collision, but the merest compromising of safety, the incident would have been reported.
What you saw
But let's consider what you saw. Our binocular vision is excellent; it can track movements, and judge speeds, sizes, angles and relative position with amazing accuracy and precise judgements, which is why we human beings can do things like return Roger Federer's serve and shoot apples off people's heads with arrows.
However, our binocular vision can do all these wonderful things only when it's operating in a rich and reliable frame of reference. In an aircraft, at night, over the ocean, we lose almost all of the reference that allows us to make accurate and precise judgements. You could be looking at a small aircraft a short distance away or a huge one far away, and you'll have little chance of knowing which. It gets even harder to judge speeds. Relative position can also be very hard to judge.
However compelling the feeling that you know what you saw, it's simply not reliable.
In this case, the compelling evidence of your perception led you to conclude that there was a risk. In aviation, we usually hear about the opposite case: where trust in compelling-but-unreliable perception causes a pilot to underestimate or even just ignore a risk. Pilots learn that perception is not a reliable friend, and that senses that work very well when playing tennis or with crossbows are hopelessly inadequate in the air.
Instead, they place their trust in a battery of proven instruments, from simple things like gyroscopes and compasses that have been key to flight safety for a century or more, to advanced radar systems, and industry wide systems and processes. They are what keeps flight safe.
It's hard to ignore the clamouring of one's alarmed perceptions, but the fact is that when you climb on board on airliner you should accept that nothing you will see or feel for the next few hours is a good indication of what it really is.
What if the pilot took evasive action?
You mention that your flight changed course slightly, with the implication that this may have been evasive action.
If your pilot had been required to take some sort of emergency last-second evasive action to avoid a collision, not one of your sleeping fellow passengers would have remained asleep: those of you not strapped down would have been hurled to the ceiling or slammed to the floor and your stomach would be heaving in a different direction from the rest of you.
You'd really know about it, in other words. And then there would be plenty of aviation industry paperwork to follow.
However, that would be an extraordinarily rare thing. Evasive action, in the still very rare cases when it is required, is taken well before it's necessary to hurl the plane around in the sky to avoid something at close quarters.
Aircraft of the kind you're talking about are fitted with equipment that monitors their sector of the sky (for miles and miles around) for other aircraft, and will advise each flight crew to climb or descend appropriately so that there is not a proximity risk.
Either way, it certainly doesn't sound like you experienced evasive action at that moment.
On being disturbed
It's completely natural to be disturbed by what you saw - but if you accept that aviation is completely unnatural as far as our senses and perception go, and they just don't work very well at making good judgements in that context, that might help.
Even if you can't let go of the reports of your perceptions (I can't), knowing that the reality is otherwise can still help.
In short: anyone else looking out of the window may well have been alarmed by what they saw. Once that moment of alarm has passed though, what you know can help prevent it from continuing to disturb.