55:5 The bracha of mezonos takes priority over hagafen; hamotzi has precedence all the moreso. This is why when we make kiddush on Shabbos and yom tov, we cover the challah or cake when reciting the bracha over the wine. It would be a source of metaphorical emabarrassment to ignore the item whose bracha would normally be recited first. (There is another reason to cover the challah when saying kiddush – to emulate the manna. The reason to which one attributes the practice may make some small differences in the details of its application – see Mishnah Brurah 271:41.)
56:1 If one made a mistake and said the bracha of mezonos over bread or hamotzi over cake, it is effective after the fact. However, if one said hamotzi over a cooked item, even if it was made of one of the five species of grain, that would not work. If one accidentally said the bracha of hagafen over grapes, it is effective after the fact. (The same is true after the fact if one drank wine and had the intention to include grapes in his bracha of hagafen – MB 208:69.) Similarly, if one accidentally recited “al hagefen” rather than “al ho’eitz” after eating grapes, that would work because grapes are, in fact, fruit of the vine.