Hi Andrea, I don't think one can prove much without flatness. Let's assume the simplest case, that $X=\text{Spec}(S)$, $Y= \text{Spec}(R)$, and $R\to S$ is a finite local homomorphism with $R$ regular. Then I claim what you want is equivalent to flatness.

Your condition amounts to
$$\text{Ext}_R^i(M,N)\otimes_RS \cong \text{Ext}_S^i(M\otimes S,N\otimes S)$$
for $R$-modules $M,N$. There is a well-known result that the first $i$ such that $\text{Ext}_R^i(R/I,R)\neq 0$ is the length of the longest $R$-regular sequence in $I$. Let $M=R/m_R$, $N=R$, then by the Ext condition we can conclude that $m_RS$ contains a $S$-regular sequence of length equals to $\text{dim}\ S$. So $S$ is Cohen-Macaulay.

But then "miracle flatness" implies that $f$ is flat! This also provides counter-examples: if $S$ is not Cohen-Macaulay, choose $i$ to be $\text{depth}\ S$.

ADDED: for the sake of completeness, here is a class of examples to show the second nice situation ($\mathcal F$ is locally free) can't be generalized to much.

Let $Y=\mathbb A^n$, $X=V(f)\subset Y$ such that $f$ vanishes at the origin. Let $\mathcal F$ be locally free on $Y$ minus the origin, but not free at the origin. Let $\mathcal G$ be any torsion-free coherent sheaf on $Y$. Then I claim the condition you want (let's call it $(*)$) will not hold.

From the short exact sequence $0\to \mathcal G \to \mathcal G \to \mathcal G/(f)\to 0$ (the first map is multiplication by $f$, exact because $\mathcal G$ is torsion-free) one can take $\mathcal Hom(\mathcal F,-)$ to get a long exact sequence. Looking at such l.e.s, $(*)$ means precisely that the maps by multiplication by $f$:
$$\mathcal Ext^i(\mathcal F,\mathcal G) \to \mathcal Ext^i(\mathcal F,\mathcal G) $$
must be injective for all $i>0$. But as all these ${\mathcal Ext}$ vanish away from the origin and $f$ vanishes at the origin,
they have to be $0$. Now localize at the origin, take a minimal free resolution of the stalk of $\mathcal F$ to compute Ext and use Nakayama, one can show that $\mathcal F$ must also be free there, contradiction.