Albert Einstein published his "special theory of relativity" in 1905. Later in the (same) year, he published another paper, using the basis of special relativity theory, arriving at an equation for "mass energy equivalence". Therefore, the equation E=mc^2 was in fact publsihed separately from the theory of relativity, although the two are publish in the same year.
The following paragraph is quoted from the web-page given below:
"That same year, which has been called Einstein's annus mirabilis or "miracle year", he published four ground breaking papers, on the photoelectric effect, Brownian motion, special relativity, and the equivalence of matter and energy, which were to bring him to the notice of the academic world.
You may refer to the first paragraph under the section on "Academic career":
http://en.wikipedia.org/wiki/Albert_Einstein