A new electrochemical imprinting technique, in which pyrrole is used as a functional monomer, has great potential to glue nanomaterials together. The molecularly imprinted polypyrrole (MIPPy), using ochratoxin A (OTA) as the template molecule, is electrochemically deposited onto carbon nanotubes (CNTs) or quantum dots (QDs) to make a solid phase of nanoscale for specific extraction of the mycotoxin. This MIPPy nanomaterial is simply structured within the 0.5-μm pores of a stainless steel frit, or inside a syringe needle, to make a novel micro solid phase extraction (μSPE) device. With the nanostructure of CNTs or QDs, the total number of specific binding sites of MIPPy-on-a-frit or MIPPy-in-aneedle is significantly enhanced for binding of OTA at subppb levels even in the presence of abundant red wine matrix components.