We will use $D_n$ for the number of derangements on $n$ elements, that is,
$$D_n = \sum_{k = 0}^{n} (-1)^k\binom{n}{k}(n - k)! = n!\sum_{k = 0}^{n} \frac{(-1)^k}{n!}$$
We consider two cases.
Case 1: $f(3) = 1$
If $f(3) = 1$, we are left with a derangement of the remaining $n - 3$ elements, so there are $D_{n - 3}$ such cases.
Case 2: $f(3) \neq 1$.
In this case, there are $n - 3$ ways to choose $j$ such that $f(j) = 1$.
If $f(3) = j$, we are left with a derangement on $n - 4$ elements. There are $(n - 3)D_4$ such cases.
If $f(3) \neq j$, then we have $n - 3$ elements to assign, each with one forbidden place since $f(3) \neq j$ and $f(i) \neq i$ for $i \neq 3, j$. Hence, we have a derangement on $n - 3$ elements. Thus, there are $(n - 3)D_{n - 3}$ such cases.
Hence, there are $(n - 3)(D_{n - 4} + D_{n - 3})$ such cases.
Total: Since the cases considered above are exhaustive and mutually exclusive, the number of permutations $f:[n] \to [n]$ such that $f(i) \neq i$ for all $i$, $f(1) = 2$, and $f(2) = 3$ is
$$D_{n - 3} + (n - 3)(D_{n - 4} + D_{n - 3}) = (n - 2)D_{n - 3} + (n - 3)D_{n - 4}$$
Note: The argument given above is based on the derivation of the recursive formula
\begin{align*}
D_0 & = 1\\
D_1 & = 0\\
D_n & = (n - 1)(D_{n - 1} + D_{n - 2}), n \geq 2
\end{align*}
for the number of derangements of a set with $n$ elements.