Theft, no. At least, I highly doubt it. From my time in German law school, I remember:
For someone to be accused of theft, it is necessary for both actus reus and mens rea to apply. The former describes the elements of offence: A personal object which is taken and removed with the intent of depriving the rightful owner of it. We have all those.
With mens rea, it gets more tricky. We need to believe we are stealing. As the thread proves, a judge would have trouble arguing that this is the case here, provided there is no additional evidence. (If, for example, the “thief” was guilty of manipulating the machine to acquire extra candy, things would change).
As it is, my guess is you are only looking at unjust enrichment, which is civil law, and as the case of a single candy bar would get rejected by any judge alive – yeah, I would take the chocolate.