I did exactly this last week, so it will be fine. My routing was BAH-DXB-DMM, two separate tickets.
I arrived from BAH into DXB at about 10:00. The connecting flight to DMM was leaving at 20:00. I had the DMM flight boarding pass in my hand from the check in agent at BAH. I went to the lounge, ate breakfast, and showered. Then, I went back downstairs (you have to go backwards through the security, just say you want to go to immigration and it will be fine) through immigration and out into Dubai. Then, at about 18:00 I just entered the terminal like normal.
The only thing is my easy gate didn't work in the evening. The guy working told me that if you stay in Dubai less than 6 hours, it will flag an error. So, I had to show my passport, no worries.