The Jacket (2005)
The Original: Injured Gulf War veteran Jack Starks (Adrien Brody) is slammed into an asylum when he's wrongly accused of murdering a cop.
Weirdy doctor Becker (Kriss Kristofferson) makes him the subject of his psychological experiments, and he starts seeing visions of the future - and traveling there to fall in love with a girl he met as a youngster (Keira Knightley).
He also learns he's going to be killed if he can't stop his own future coming true...
With Added Doc Brown: Doc decides to help out and rescues Jack from the morgue locker where he's trapped by Doctor Becker.
Taking him in the flying train back to the Gulf War to try and stop his original injury from ever happening, problems crop up when he prevents the war itself from happening.
Risk To The Space/Time Continuum: Turns out Jack was actually a new dictator in the making, and he dumps Doc out of the train, skips back in time and becomes all-powerful.
The galaxy ends up ruled by a half-Brody, half-'bot despot