If you're running a hackathon in a company do it on company time and make sure to be prepared to do something with the ideas they generate. Results of our recent hackathon is a good example how to do it: out of 7 out of 14 projects are finding their way to the product roadmap. We run it on Thursday-Friday with demos on Monday morning.
If you don't follow up, event may backfire and will remain an example how a company merely pays lip service to ideas coming from developers.