Honestly I wouldn't let them do that. There is a line I think we don't need to cross homework wise. Get your stuff done as best you can, get to bed at a decent time, and be ready to do it again.
well on that front, I'd ask what they were doing from 4pm-2am that lead to them working on homework at 2am.
My belief is the kid's "job" is to be a student. So if them working, or their extracurriculars are causing an issue with their learning then those need to be reduced or eliminated.