It is known that the microturbellarian Stenostomum sphagnetorum, a common ciliate predator, is very sensitive against different types of toxins produced by other ciliates for chemical defense, and consequently, it is not able to capture and ingests these ciliates. In particular, when the predator tries to attack one of these toxin-secreting ciliates, it is forced to regurgitate the captured prey in response to the toxin discharged from the ciliates. In this study it is shown that after repeated attacks by S. sphagnetorum against two species of toxic ciliates (Spirostomum ambiguum and Spirostomum teres), the predator acquires a behavior of prey selection that leads to the exclusion of these ciliates among the possible prey and to the distinction between edible and inedible (toxic) ciliates. This learned behavior, which is maintained for days, is lost only after the asexual reproduction of the microturbellarian. In addition, S. sphagnetorum learns to recognize and avoid specimens of S. ambiguum and S. teres artificially deprived of their toxins, strongly suggesting that the toxins are not exclusively associated in the prey recognition of the microturbellarian.