The best thing to do in this situation is
- give the guy a day off
to compensate for the time.
I would say DON'T give a gift or money. If you do that, the person will continually work late to get gifts and money.
Give them a day off, tell them to make sure it doesn't happen again, and as the team lead make sure it doesn't happen again.
Note that of course
None of this should ever happen - obviously
Setting aside a crap, disorganized company, any programmer who works late is 20 years out of date. Nowadays, as a rule, any programmer who works "late" is just seen as amateurish, sloppy. "Cowboy" scripts, "hero-slop" programming, and "extreme! hobbyist! enthusiasm!" is not software engineering. There'sNowadays, software is built by people who build software in the same way people who build suspension bridges build suspension bridges: in a professional, orderly manner. There's a reason everything used to crash all the time 20 years ago.