The story of the mergalim is immediately followed by the parsha of nesachim and the parsha of mitzvas challah, both of which seem out of place here. Nesachim would seem to fit better somewhere in VaYikra, or perhaps in Parshas Pinchas where the nisachim of korbanos hachag are discussed. Challah seems to fit in with terumos and ma'asros, not here. So why does the Torah choose this place to discuss these halachos?
Ramban adopts the view (it is a machlokes Tanaim) that nesachim were only offered in Eretz Yisrael. Based on this he explains that the Torah here is reassuring Bnei Yisrael that despite the setback of having to spend 40 years in the desert, they will ultimately get to Eretz Yisrael. The same idea holds true of challah, which is the only agricultural-type mitzvah that applies immediately upon entering Eretz Yisrael, even before the land is conquered and divided.
Even though the Ramban himself doesn't say it, I think there is a connection between nesachim and a Ramban earlier in the parsha. What did Moshe Rabeinu hope to gain by sending meraglim? Surely Moshe believed that Eretz Yisrael was a land of "zvas chalav u'devash," and no matter what the report, he intended to lead Bnei Yisrael to Eretz Yisrael. So what did he hope to gain? Ramban explains that Moshe Rabeinu was fully confident that the spies would bring back a glowing report of Eretz Yisrael. The description of the land's beauty would serve to heighten Bnei Yisrael's enthusiasm for the task of kibush and yishuv ha'aretz. Moshe wanted Bnei Yisrael to not just enter the land, but to do so b'simcha, with hislahavus. [Obvious lesson of how important how a mitzvah is done is.]
The Midrash darshens the pasuk in Koheles (9:7), "Leich echol b'simcha lachmecha u'shtei b'lev tov ye'einecha ki kvar ratzah ha-Elokin es ma'asecha," as referring to our parsha. The lechem the pasuk refers to is challah; the wine the pasuk refers to is nesachim; both showed that Hashem still desired the avodah of Klal Yisrael despite the cheit hameraglim. In light of the Ramban, I think the key words here are "simcha" and "lev tov." Even though the attempt to inject simcha and hislahavus into the mitzvah of kibush ha'aretz ultimately resulted in the entire miztvah being lost for a generation, that doesn't mean these values carry no weight. It doesn't mean we should push aside emotion lest it disrupt or cause the loss of the ikar mitzvah. Echol b'simcha.. shtei b'yein tov -- don't throw the baby out with the bathwater.
The Ishbitzer has such a classic Ishbitzer torah (no other way to describe it) here. The pasuk in Koheles refers first to lechem and then to wine. Why then does our parsha first introduce the mitzvah of nesachim, wine, and only secondly present the halachos of challah, bread, the reverse order of the pasuk in Koheles?
The difference between bread and wine is that wine takes little effort to produce -- the juice is already there inside the grape. Bread, however, takes enormous effort to produce. You have to harvest the wheat, mill it, turn the flour to dough, bake the dough, etc. There are a whole host of melachos on Shabbos that we derive from the numerous steps in the process of producing bread. Bread is symbolic of yiras shamayim -- a person has to work on him/herself day in and day out to maintain yirah, and certainly to grow in yirah. It's not an easy task. Wine is symbolic of the connection each and every one of us has b'omek halev to Hashem, a connection that can never be extinguished or destroyed,a connection which is there whether we work on it and want it to be there or whether we ignore it.
Under ordinary circumstances, bread precedes wine. A person has to first grapple with the challenge of building his/her yiras shamayim, but after all that grappling, the end result is that a person realizes that all along they were connected to Hashem b'omek halev -- it was always like wine. But sometimes that doesn't work -- sometimes a person is so down and out that the prospect of engaging in the avodah of lechem is overwhelming; it's too daunting, it seems beyond anything a person is capable of. In that case, you have to start with the avodah of wine. You need to remind a person that no matter how far he/she has fallen, b'omek halev there is still a connection. Beneath the surface, just like the juice inside the grape, the sweetest taste is there already. That chizuk will be the motivation to once again return to making bread, to putting in the effort to grow and come closer through one's own avodah.
After the cheit hameraglim, Bnei Yisrael felt they were the lowest of the low -- they didn't have the strength to go on. The Torah had to first give the parsha of nesachim and remind them that b'omek halev they were and always will be connected to Hashem, and only then remind them of the mitzvah of challah, of the need for great avodah and growth in yirah.