Phew! The information on this is not clear at all almost anywhere on the internet. But after careful hunting, I have been able to find the relevant tool.
Based on the comments, I was able to understand two things:
You have already booked a flight from DXB (Dubai) to AMS (Amsterdam) to UIO (Quito)
You wish to book a flight from Lahore to Dubai which of course would be on a different itinerary, which would make me believe that you will have to re-check in your bags.
You mentioned 5am which makes me believe that you will be taking Emirates Flight 623
Now, I understand why your questions was initially about the timing, because the transit visa requirements at the Dubai airport are somewhat vague and you can apply for a 96-hour transit visa if your transit is greater than 8 hours and of course if you hold an onward ticket.
So, considering your situation, the fact that you will be re-checking in bags is more important than anything else.
If you do have to re-check in your bags, then you will need a proper visit visa to enter Dubai otherwise you will not be allowed to do so, possibly not be allowed to board the Lahore to Dubai flight as well. This is well documented by experience from several users on the answers to this question - Can I through check my bags on separate bookings (international flights)?.
Now, if you won't be rechecking in your bags, this situation will be completely different but even then the time will not matter.
The Emirates website has a nice tool for finding your necessary Visa Information. Feeding in the information you presented to us earlier, I was able to obtain this.
So, if you are traveling to Ecuador via Netherlands and Dubai as an Ecuadorian Citizen, and in relation to Dubai,
TWOV (Transit Without Visa):
Holders of confirmed onward tickets for a
max. transit time of 24 hours. Visa is required for transit between
Dubai International Airport (DXB) and Dubai Al Maktoum International
Visa Issuance: A 96-hour transit visa can be obtained on
arrival at Dubai (DXB), provided:
- transit time is at least 8 hours; and
- holding onward ticket to a third country; and
- holding a passport valid for at least 6 months from date of arrival. Visas are only issued as a part of a transit package together with
hotel accommodation and airport transfer.
Also, I would believe this source to be fairly legitimate being on the Emirates website and directly sourced from IATA which is mentioned on the tool.
In my opinion, your best bet is to get the Emirates ticket and before getting it inquire from Emirates about your situation whether they can re-check in the luggage for you or you can do it without any additional visa requirements.