Heat sets a stain permanently, so the first rule is cold water and the second is speed. Blot, don't rub — rubbing pushes the stain into the weave.
Oil needs washing-up liquid. Wine needs cold water and salt. Coffee needs a soak. And nothing goes in the dryer until you're certain the mark has gone.