All I remember is that everyone in the space ship was asleep except one person. I think he was the security officer on board. They had to travel for 3 years but the flight got interrupted by bandits that boarded the ship. A big chunk of the movie was about the lonely security guy, he was running around in his PJ-s and dancing to classical music and stuff. I think the movie is made in the 90s.
Your description and particularly the lonesome security officer horsing around in his underwear matches Velocity Trap (IMDb article, Wikipedia article). He is portrayed by martial artist Olivier Gruner.
2 minor discrepancies: the ship is carrying 40 billions(!) of universal dollars in cash, not gold, and the trip is for a couple of months, not 3 years.