This can be either films that just baffle you until a great ending ties the whole thing up nicely, or films that aren't that good but which are almost saved by a great ending....or a combination of the two.
In the first camp:
Scream and Scream Again (bonkers Amicus 70s thing)
Sleuth (I know it's from a play. Both film versions are great btw, don't overlook the Caine/Law one)
In the second camp:
Signs (yep, it's Shymalan, and I still don't LIKE the film as a whole, but the end DOES work)
The Taking of Pelham 1-2-3 (1973 one)