A planet that should have been eaten by a huge star has baffled scientists until now.