Given a function of sets $f:X\to Y$, one defines the direct image and inverse image maps: $$ f_*:\mathcal{P}(X)\to\mathcal{P}(Y) $$
$$ f^{-1}:\mathcal{P}(Y)\to\mathcal{P}(X) $$
In the usual way.
On the other hand, given a continuous map of topological spaces $f:X\to Y$, and a nice category $\mathcal{C}$, one defines the direct image and inverse image functors between the corresponding categories of $\mathcal{C}$-valued sheaves: $$ \bar{f}_*:Sh_{\mathcal{C}}(X)\to Sh_{\mathcal{C}}(Y) $$
$$ \bar{f}^{-1}:Sh_{\mathcal{C}}(Y)\to Sh_{\mathcal{C}}(X) $$
(the bar over $f$ is just to distinguish between the notations).
Now, the terimnology suggests some connection between the notions, so I tried to work it out myself. It turns out that there is a rather obvious connection, but it conflicts with the terminology! Namely, we can view $\mathcal{P}(X)$ and $\mathcal{P}(Y)$ as poset categories with respect to inclusion, and this turns $f_*$ and $f^{-1}$ into functors (as they preserve inclusions). This seems like the obvious first step, but we can already see that something is wrong, since the pair $(f_*,f^{-1})$ is andjoint, but in the wrong order! Namely, $f_*$ is the left adjoint and $f^{-1}$ is the right (translation: $f(A)\subseteq B \iff A\subseteq f^{-1}(B)$ and not the other way around) as opposed to the situation with sheaves.
Now, we can go further and interpreate the category $\mathcal{P}(X)$ as a category of sheaves on some space. Indeed, it is isomorphic (!) to the category of "truth-valued" sheaves on the discrete space on $X$. Under this isomorphism, the functor $f^{-1}$ indeed corresponds to $\bar{f}^{-1}$ (note that no colimit is needed in the definition of $\bar{f}^{-1}$ since the space is discrete). But as we can already expect, $f_*$ does not correspond to $\bar{f}_*$.
In fact, since $f^{-1}$ preserves union as well as intersections, and hence cocontinuous as well as continuous, it has a right adjoint as well:
$$ f_!:\mathcal{P}(X)\to\mathcal{P}(Y) $$
that can be defined by $$ f_!(A)=\{y\in Y \mid f^{-1}(y)\subseteq A\} $$
and in fact it is this functor that corresponds to $\bar{f}_*$ and not $f_*$. So, finally, my question is this:
Is there some other connection between the two notions that makes the analogy work, or is it just unfortunate coincidence in terminology?