Most creatures in the animal kingdom have three cell layers; endoderm, ectoderm, and mesoderm. Mesoderm is particularly important in increasing complexity, as many of our internal organs are derived from this layer. So when did this layer arise?
To look at this question many researchers have turned to cnidarians (jellyfish & anemones), which only have two layers, to examine the developmental and genetic clues. To make things confusing, some cnidarians posses a third layer, called a entocodon, where some muscle cells reside. Also, all ctenophores (comb jellies) also posses muscle cells. Muscle cells are generally thought to have arisen from mesoderm. So was the ancestor to cnidarians, ctenophores, and bilaterians (everybody else) triploblastic (having three layers), and the cnidarians and ctenophores just lost that layer? Or was the ancestor diploblastic (having two layers) and muscle cells arose separately in all groups?
Looking at some of the genes that are commonly associated with mesoderm, Martendale et al. (2004) found that a majority of these genes are present in his model anemone, and generally tend to be expressed in the endoderm. This means that the tools for creating mesoderm was present in cnidarians, and that most likely, mesoderm arose from endoderm at some later date. However, finding the genes in the endoderm does not completely rule out the possiblity that cnidarians had mesoderm, but that it was lost at a later date.
Burton (2008) reviewed the two possibilities, diploblastic or secondarily diploblastic through mesoderm loss, and makes several excellent points based on numerous papers. First, the third tissue in some cnidarians (entocodon), is not the same genetically or developmentally as mesoderm. The entocodon arises from the ectoderm at a much later developmental time (after gastrulation) than mesoderm. Plus, genes associated with mesoderm are not always expressed in the entocodon, they are more likely to be expressed in the endoderm. So the entocodon is most likely a new cell layer and not a modified mesoderm layer.
Muscle cells found in ctenophores and cnidarians are not the same as those found in bilaterians or even to each other, however the genes are similar. Therefore, it is likely that the genes for muscles were found in the ancestors to ctenophores, cnidarians, and bilaterians and each group slightly modified those genes to get their present shape. In triploblasts, these genes along with others became associated with the mesoderm cell layer, when those cells migrated from the endoderm. Interestingly, in cnidarians the genes associated with mesoderm in bilaterians appear to be used in body patterning. So essentially, cnidarians have two sets of body patterning genes, one of was free to develop into mesoderm and subsequently, internal organs. Even cooler, (I think) ctenophore lack one set of body patterning genes, the Hox genes. Did they lose it? Or did they never have it and we are more closely allied with cnidarians? Do sponges and placazoans have Hox genes? I guess it's time for more reading!
Burton, P.M. 2008. Insights from diploblasts; the evolution of mesoderm and muscle. Journal of Experimental Zoology Part B-Molecular and Developmental Evolution. 310B:5-14
Martindale, M.Q., K. Pang, and J.K. Finnerty. 2004. Investigating the origins of triploblasty: 'mesodermal' gene expression in a diploblastic animal, the sea anemone
Nematostella vectensis (phylum, Cnidaria; class, Anthozoa). Development. 131:2463-2474