TITLE: Why do we retain exactness when tensoring by $\mathcal{O}_C$ in Hartshorne, Lemma V.1.3?
QUESTION [11 upvotes]: Hartshorne, Algebraic Geometry, Chapter V, Lemma 1.3, reads (in part):

Throughout this chapter, a surface will mean a nonsingular projective surface over an algebraically closed field $k$.  [...] Let $X$ be a surface. 
[...]
Lemma 1.3.  Let $C$ be an irreducible nonsingular curve on $X$ , and let $D$ be any curve meeting $C$ transversally.  Then
  $$\#(C \cap D) = \deg_C(\mathscr{L}(D) \otimes \mathcal{O}_C).$$
  Proof.  [...] We use the fact that $\mathscr{L}(D)$ is the ideal sheaf of $D$ on $X$.  Therefore, tensoring with $\mathcal{O}_X$, we have an exact sequence
  $$0 \to \mathscr{L}(-D) \otimes \mathcal{O}_C \to \mathcal{O}_C \to \mathcal{O}_{C \cap D} \to 0$$
  where now $C \cap D$ denotes the scheme-theoretic intersection. [...]

So apparently we've taken the exact sequence
$$0 \to \mathcal{O}_X(-D) \to \mathcal{O}_X \to \mathcal{O}_D \to 0$$
of coherent sheaves on $X$, tensored by the coherent sheaf $\mathcal{O}_C$, and the resulting sequence is still exact.  
Now, as I understand it, $\mathcal{O}_C$ is not flat: Proposition III.9.2(e) says that a coherent sheaf on a noetherian scheme is flat iff it is locally free, and $\mathcal{O}_C$ is clearly not locally free since it's supported on a curve.  (Of course I guess I don't actually need flatness here.)

REPLY [6 votes]: Note that
$$0 \to \mathcal{O}_X(-D) \to \mathcal{O}_X \to \mathcal{O}_D \to 0$$
tensor by $\mathcal{O}_C$ is just
$$0\to {\mathcal Tor}_1( \mathcal{O}_D,\mathcal{O}_C)\to \mathscr{L}(-D) \otimes \mathcal{O}_C \to \mathcal{O}_C \to \mathcal{O}_{C \cap D} \to 0$$
since $\mathcal{O}_X$ is flat.
Now ${\mathcal Tor}_1( \mathcal{O}_D,\mathcal{O}_C)$ is a sheaf supported on ${C \cap D}$ and  $\mathscr{L}(-D) \otimes \mathcal{O}_C$ is locally free on $C$.
Note that the subsheaf of a locally free sheaf can not be torsion, hence
$${\mathcal Tor}_1( \mathcal{O}_D,\mathcal{O}_C)=0$$.