Our Lord, did not cry out in despair, He was quoting Psalm 21(22) and identifying with the whole of the Psalm. The first part deals with His current situation and how it appears but the final part announces the triumph of His act of Redemption. This Psalm is probably the most messianic in the whole Psalter.
Also if He didn't have foreknowledge of the 'cup', what was He asking to be delivered from?