You can get an FMM at the downtown immigration office. It is supposed to be open 24 hours, but from my own experience you might have to look for someone there late at night.
Why would you want to go to Nogales at 3 am in the first place?
We are driving through to Ciudad Obregon and want to get the early in the morning
This is not an area to drive at night. It's a 7-8 hour drive in good conditions without stops from Nogales Sonora to Ciudad Obregon. You might consider taking a bus instead of driving.
Bob, we get Mexican guests at our hotel who will leave at 2 or 3 AM- when I asked one couple once if there was something wrong that they were checking out at 2 AM, they explained that no, it was a good time to leave for a faster return through the Port of Entry.