What is the connection between direct/inverse image of set maps and direct/inverse image functors of sheaves? 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? 

 A: Here is a setting in which the question can be made more precise. Consider a continuous map $f: X \to Y$ of topological spaces which is also open. Let us denote by $O(X)$ and $O(Y)$ the posets of open subsets of $X$ and $Y$ respectively. Since $f$ is both continuous and open the image of an open is open and the inverse image of an open is open. As in your description, we obtain an adjunction between the posets $O(X)$ and $O(Y)$.
Now consider the categories $Sh(X)$ and $Sh(Y)$ of sheaves of sets on $X$ and $Y$ respectively. We have the inverse image functor $f^*: Sh(Y) \to Sh(X)$ and direct image functor $f_*: Sh(X) \to Sh(Y)$. Now each open $U \in O(X)$ represents a set valued sheaf $rU \in Sh(X)$ and similarly for $Y$. Hence the following well-defined version of your question naturally arises: 
1) For $V \in O(Y)$, is it true that $f^*(rV)$ is the sheaf represented by $f^{-1}(V)$?
2) For $U \in O(X)$, is it true that $f_*(rU)$ is the sheaf represented by $f(U)$?
It is easy to verify that the answer to the first question is yes and the answer to the second question is no. However, in this particular case the functor $f^*$ admits a left adjoint $f_!: Sh(X) \to Sh(Y)$ as well, and (2) will become true if we replace $f_*$ with $f_!$.
In particular, it seems that there is a certain clash of terminology here, which appears to be accidental. You might ask why didn't they call the functor $f_!$ "direct image" instead of $f_*$. One possible reason that comes to mind is that $f_*$ always exists while $f_!$ does not in general. In any case, there doesn't seem to be any hidden connection beyond this. 
