Its an old film, often shown on Film4 but it has one of the best flip the narrative endings, the Caine Mutiny.
Starring Humphrey Bogart, you see a new enlistee joining a destroyer during WW2.
Bogart joins as the captain a bit later in the movie and the story makes you dislike him, leading to a mutiny during a typhoon when he begins to crack under the pressure.
Theres a court martial for one of the officers who lead the mutiny and the defending officer wins the case for the accused.
Then the big switch, he tells the crew they were mutineers and proves it whilst painting one of the good guys as a coward and sneak, you never saw that coming until late in the movie.