How many of the Star Warses qualify? "Duel of the Fates" is an astonishingly great cue from an otherwise terrible movie.
I have a whole playlist of awesome movie scores, and there are a fair number of bad movies represented. (For a number of years I did movie and TV scores on Twitter under the tag #TrikeTuneTip, if you want to go down that rabbit hole.)
One of the all-timers in this category of Great Soundtrack, Terrible Movie has to be Robin Hood: Prince of Thieves. The score is epic and magnificent, everything that Kevin Costner's peek-a-boo accent isn't. Even more surprisingly is that it's by Michael Kamen, whose work I don't typically enjoy, but he crushed it here.
Another one is Treasure Planet. I actually don't recall much about the flick other than thinking "meh" at the time. But the score by James Newton Howard is spectacular, start to finish.
Oh, and John Debney's score for Cutthroat Island, the Geena Davis pirate movie. So good. One of my favorite movies of the early talkies is Captain Blood (I even had two characters named that back on Live), and it's pretty clear Debney was updating Korngold's score for that film. Which makes sense: everyone steals from Korngold, especially John Williams.