I assumed that Grand Maester Pycelle was the culprit. He has fallen out of favor with Cersei and she dispatched him to the kitchen where he could have poisoned the pie or wine. He obviously hates Tyrion, who sent him to the dungeon. I'm guessing he poisoned the pie, knowing the Joffrey would take the first bite.