Flatness over a regular local ring of dimension $1$ Let $(A,\mathfrak{m})$ be a regular local ring of dimension $1$. We set the usual notations: $K$ denotes the fraction field of $A$, $\kappa = A/\mathfrak{m}$ denotes the residue field and $\pi$ denotes a generator of $\mathfrak{m}$. For example, if $A = \mathbf{Z}_p$, then $\mathfrak{m} = (p)$, $K=\mathbf{Q}_p$, $\kappa = \mathbf{F}_p$ and we can take $\pi = p$.
I've heard that in this specific case, a homomorphism of (commutative) rings $A\to B$ is flat as soon as dim($B\otimes K $) = dim($B\otimes \kappa $) (i.e. as soon as the fibres have the same Krull dimension).
As pointed out in the comments, in this case, $B$ being flat over $A$ is equivalent to say that the map $B\to B\colon x\mapsto \pi.x$ is injective. Also note that equidimensionality is not a necessary condition (thanks @Mohan for pointing this out).
Answer: the assertion is false as stated, see the interesting counter-examples by @David Lampert and @Johann . Interestingly, the assertion is also false even if we assume that the fibres are smooth (the closed fibre is non-smooth in David's example, but the fibres are obviously smooth in Johann's example). Also note that by the miracle flatness theorem, it would suffice to require that $B$ is Cohen-Maccaulay.
After thoughts: In the end, the result I needed is the following:
Lemma: let $A\to B$ be as in the question. Assume that $B$ has equidimensional fibres, and furthermore that the closed fibre is irreducible and smooth. Finally, assume that there exists a closed embedding of $A$-schemes $\mathbf{A}_{A}^1\to \mathrm{Spec}B $ of the affine line over $A$ to $\mathrm{Spec}B$ (i.e. a surjective $A$-algebra map $B\to A[X]$). Then $B$ is flat over $A$.
Proof: Let $X$ be the (schematic) adherence of $\mathrm{Spec}(B_K)$ in $\mathrm{Spec}B$. By definition, $X$ is a flat $A$-scheme, and its closed fibre is non-empty because $\mathrm{Spec}B$ contains $\mathbf{A}_{A}^1$. Furthermore, $X_K = \mathrm{Spec}(B_K)$. Hence, $X_{\kappa}$ is a closed subscheme of $\mathrm{Spec}(B_{\kappa})$ of the same dimension than $\mathrm{Spec}(B_{\kappa})$. But this implies $X_{\kappa}=\mathrm{Spec}(B_{\kappa})$ because by assumption, $B_{\kappa}$ is a domain.
 A: Look up the "miracle flatness" theorem.  An example: $A=\mathbf{Z}_p \subset B=\mathbf{Z}_p[[x]]/(px,x^2)$ is a local map of Noetherian local rings with equidimensional fibers which is not flat (but $B$ isn't Cohen-Macaulay).
Edit #2:  If $A$ is a DVR and $A \rightarrow B$ is a local map with $B$ a localization of a finitely generated $A$-algebra and fibers are equidimensional with regular special fiber then $A \rightarrow B$ is flat and $B$ is regular.  I think this all can be found in Matsumura's books.  
A: This is not true as stated - $K \times \kappa$ is the usual counterexample. The problem is that the fibers, while having the same dimension, do not "vary continuously". Geometrically, it is just a disjoint union of generic and closed point.
The assumption you might want to add is that $B$ is finitely generated as an $A$-module. This excludes $K$, so you can't cheat as above by just adding sufficiently many copies of $K$ to force equidimensionality. Indeed, your statement becomes true by the Yoneda lemma - lifting a basis of $B \otimes \kappa$ gives you now a generating system of $B$ which becomes a basis after tensoring with $K$. Hence, multiplication with $\pi$ is injective.
A: I received an interesting answer from Francesco Polizzi by e-mail, so I thought I would share it here as well. Here is a (slightly deformed) quote of his mail (keeping the notations of my question, so $R$ is a regular local ring of dimension $1$):
"Assume that $B$ has no non-zero nilpotents. Then $f\colon R\to B$ is flat if and only if for every irreducible component $B_i$ of $B$, the generic fibre of Spec$(B_i)\to $ Spec$(R)$ is non-empty. This can be found as Proposition 9.7 in Hartshorne, Chapter III (p.257).
In particular, equi-dimensional fibres implies flat if one assumes that $B$ is reduced and irreducible."
