In the common phrase "tack för senast", one expresses gratitude for having been received as a guest at a previous (the most recent = senast) occasion. This is used as a greeting phrase when first meeting the former host. If the host received a gift, it is common to answer "det är jag som ska tacka".