Kuo-Toa has a special quality "Divine Talent" That lets him cast spells as an 8th level evil cleric. The hobgoblin has the special quality "Arcane talent". There is no spellcasting (ex) in the entries.
Anyway, enough debate. I will assume that you cannot imitate abilities that are not specifically (ex) in their entries.