This work reports the synthesis and the binding tests on the 5-HT(3) and 5-HT(4) receptors of new thienopyrimidopiperazine and piperazinylacylaminodimethylthiophene derivatives, in order to identify potent and selective ligands for each receptor. The compound with higher affinity and selectivity for the 5-HT(3) over the 5-HT(4) receptor was the 3-amino-2-(4-benzyl-1-piperazinyl)-5,6-dimethyl-thieno[2,3-d]pyrimidin-4(3H)-one 28 (5-HT(3) K(i)=3.92 nM, 5-HT(4) not active), the compound with higher affinity and selectivity for the 5-HT(4) over the 5-HT(3) receptor was the 2-[4-[4-(2-pyrimidinyl)-1-piperazinyl]butanoylamino]-4,5-dimethyl-3-thiophenecarboxylic acid ethyl ester 41 (5-HT(4) K(i)=81.3 nM, 5-HT(3) not active). Conformational analyses were carried out on the compounds of the piperazinylacylaminodimethylthiophene series (39-42) taking compound 41 as the template.