You can't. "Gain" only means from the Supply unless the card specifies that you gain something from another zone.
Makes sense. I tried looking it up in the Cornucopia and Adventures manual, should've looked into the base one, it seems!
I don't know whether the base rules explicitly state that "gain" is by default from the supply. Maybe in the rules about the trash and/or Thief, but there's not much going on in terms of non-supply besides that.
Either way, the rule is simply this: If a card says "gain" without naming a target, it's from the supply. If it names a specific pile, it's from that pile. Thief doesn't strictly say "from the trash", but the wording makes clear that you gain the cards from the trash. So, if Jester hits a Spoils, it can't gain it, but a Thief hitting one will trash it (nothing on either card prohibits trashing a Spoils) and then be able to get it from there.