Is it ok to eat after midnight after observing the 8 precepts? if I observe the 8 precepts today,fast in the afternoon and eat at 12am the next day, is it considered a sin?
No. It's also not a cheat, when one resolves to keep the Uposatha-precepts for one day, good householder. Sadhu. Nevertheless maybe taking the Buddhas further encouragements into consideration: Sakka Sutta: To the Sakyans (on the Uposatha)
(btw. day starts with sun rise, and eating at right time means from sun rise till sun at zenith, lesser a matter of time by clock as this could be differently.)