Pharaoh and Haman, and their hosts were sinners ...
And Pharaoh said, "Council, I know not that you have any god but me. Kindle me, Haman, a fire upon the clay, and make me a tower, that I may mount up to Moses' god; for I think that he is one of the liars." [Sura 28:8,38]
Pharaoh said, "Haman, build for me a tower, that haply so I may reach the cords, the cords of the heavens, and look upon Moses' God; for I think that he is a liar." [Sura 40:36-37]
This is another possible example of two historical compressions in the same story and the same confusion in both texts that recount the event. At least in this case, the Qur'an is consistent within itself.
According to Surah 28:35-42 and 40:36-37, Haman was a minister or official of the Pharaoh (king of Egypt) who lived in the same time as Moses. According to Jewish history Haman served as the minister of Ahasuerus (king of Persia, Xerxes I is his name in Greek). Apart from the error in location, this is placing Pharaoh (Moses) and Haman in the same story even though they lived 1,000 years apart. [See Esther 3:1.]
Furthermore, in the Qur'an Haman is ordered by Pharaoh to build a tower reaching into heaven ("the Tower of Babel") which is a well known story of an event that took place long before Abraham, who lived at least 400 years before Moses. [See Genesis 11:1-9, especially the verses 3-4, "Let us build make bricks and bake them thoroughly. ... and build a ... tower that reaches to the heavens."]
This connection is confirmed through another piece of historical, archaeological evidence.
This article has created quite a bit of further discussion. The following rebuttals to Muslim responses provide much more detail on this matter (1, 2, 3).
Contradictions in the Qur'an
Answering Islam Home Page