Recently, while learning the sefer Nefesh Hachaim, I discovered a Gemara that he quotes in Avodah Zarah that has very interesting implications. The Gemara there says that when Adam saw the sun go down on the first Friday night, he thought that it was because of his sin, and that the sun would not rise again. He and Chava cried all night, and when they saw the sun come up in the morning, they realized that it was the way of the world for the sun to set and to rise. Adam then brought a sacrifice of an ox whose horns preceeded its feet.
The commentaries explain what is meant by an "ox whose horns preceeded its feet." Ordinarily, an ox's feet preceed its horns - an ox is born without horns, and they only grow later. This ox, however, was the original ox that Hashem had created. When Hashem created the original animals, even though they were brand new creatures, they were not created as babies of that species, but rather fully grown. Thus, as the ox 'grew' out of the ground, its head came up first, including its fully developed horns. Only afterwards did its feet develop. Thus, its horns preceeded its feet.
The Nefesh Hachaim understands that Adam brought this offering in atonement for his sin. He explains that the significance of the fact that the horns preceeded its feet is that the horns represent that which is elevated above the head - namely the transcendent levels of the soul. The feet represent the lowest levels of the soul. Thus, Adam was drawing down the light of Teshuva from the very highest levels to the very lowest.
What is very interesting here is that, as we have said, Moshiach ben Yosef is represented by this very animal - the ox. He is also the one that is involved in the rectification of Adam's sin, and the way he does this is by accessing the highest levels of the soul, namely the yechida. Thus it could be that this gemara is alluding to Moshiach ben Yosef himself.
(Something else to think about is the Ram that Avraham avinu brought in place of Yitzchak at the akeida. It also had this characterisitic, because it also was created during the first six days of creation, thus its horns preceeded its feet. This sacrifice had a different function than Adam's, but we nevertheless see the parallel. It is also important to note that those very horns were the ones by which the Ram was caught. Additionally, those horns were the two shofaros, one of which was blown at har Sinai, the other of which will be blown at the advent of Moshiach.)
There is another Gemara I came across recently that also seems to hint to the concept of Moshiach ben Yosef. The Gemara is in Sotah (I think it is דף י"ג) and it is speaking about Yosef and his brothers bringing Yaakov's casket up to Israel for burial. As they do so, the children of Yishmael, Esav and Keturah all come out to make war with them. However, when they see Yosef's crown hanging on the casket, they stop, and their princes place their crowns, numbering thirty six, upon the casket as well.
There is clearly a lot going on in this Maamar Chazal, but I would just like to focus on one aspect of it. First, what is meant by Yosef's crown - what does it refer to? Secondly, what about this crown causes the chidren of Yishmael, Esav, and Keturah to give up their own crowns?
It could be said that this Gemara is alluding to the war of Gog Umagog, in which the chidren of Yishmael (the Arabs), Esav (the West), and Keturah (the East!) come together to do battle against the Jewish people. Leading the Jews is Moshiach ben Yosef, and his power of protection comes from his 'crown.' Connecting this to the previous thought of the Nefesh Hachaim, the crown (כתר) represents the highest level of the soul, which only Moshiach ben Yosef can access. This transcendental level represents the Torah of Moshiach, as well as the concept of Teshuva, both of which are integral parts of Moshiach ben Yosef's job.
When the children of Yishmael, Esav, and Keturah see the crown of Yosef - that is, the power of his Torah and Teshuva - they remove their own crowns - their own versions of the spiritual reality - and submit themselves to Moshiach ben Yosef. Thus, all will admit to the truth of the Torah.
What is extremely interesting about this theory is that it clearly echoes something that I have heard from a number of sources, among them Rebbe Nachman. That is, that the final war of Gog Umagog is not a physical war, but rather a spiritual war. This would seem to be exactly what is going on in this Gemara in Sotah.