The truth is, you don't need a sun to define days. All you need are regular repeating intervals of light and darkness. We read in Genesis 1:1 that the first thing God created was space and earth. So we have a rotating planet. In Genesis 1:3 we see that the next thing God created was light. Most likely, as soon as God said "Let there be light." the entire earth was illuminated. Light came from all directions and had to be coalesced into a single source in verse 4.
Now there is a rotating earth with light on one side and darkness on the other. That's all that is needed for the term "day" to be used. Verse 5 specifies that there was evening and morning, that is, the earth was rotating out of and into the light just as it does today. This is one reason why I believe the six days of Genesis have to be six literal days. How can you apply the terms evening and morning to an unspecified length of time? Also, the terms "first day", and "second day," etc. point to literal 24 hour periods. If I was talking to you about my vacation and said "On the third
day there," you would assume I meant the third literal 24 hour period.
On the fourth day, then, God takes the light and confines it to a source. Actually several sources, for he makes all of the stars on this day, not just the sun. But the light already existed, now there's just this big ball of plasma for it to come from. An interesting parallel can be found in the description of the New Earth in Revelation 21:23. It says that the New earth won't need a sun for God will provide the light from his own shekinah. That is his own glory. Maybe that's how there was light before the sun in the beginning. We'll never know the source of the first light. After all, the Bible is not a science book, as skeptics are quick to point out. But it is a history book, so we can believe it when it describes the creation.