The Midrash at the opening of Parshas Terumah contrasts our receiving of the Torah with an ordinary sale. In a normal sales transaction, the seller gives his property to the buyer and departs. Hashem, the "seller" of Torah, kavyachol was included in the deal and came along with the Torah to us. The same idea is captured in the Zohar's statement that "Oraysa v'Kudsha Brich Hu chad hu" -- the Torah and Hashem are one.
Basing himself on this Midrash, R' Chaim Volozhiner (Nefesh haChaim 4:10) explains that it makes no sense to speak of dveykus as a goal of the process of Torah learning or an ingredient necessary for its fulfullment. Dveykus is inherent in learning. Since G-d is one with the Torah, one cannot learn a page of gemara or a Tosfos without in some way connecting with Hashem. Torah lishma means there is no higher goal which is the purpose or aim or Torah study; Torah is synonomous with Hashem and is therefore the supreme religious value which justifies all else.
The Ba'al Shem and chassidus take a different view of things. Torah lishma in the Besht"s thinking means Torah study for the sake of dveykus; Torah is itself a mean to religious attachment to G-d, which is the supreme value (see Tzava'as haRiv"ash #30, esp. the shinuy nuschaus, which indicates that were it possible to achieve complete dveykus learning might no longer even be necessary!) Since it is hard to focus on contemplation of G-d while studying a Tosfos, one should take periodoc breaks while learning to refocus on the ultimate goal of dveykus.
The Midrash on our parsha which R' Chaim Volozhiner used as his prooftext has an interesting ending. The Midrash concludes with an exhortation by Hashem to build a Mishkan for his presence, which comes to us with the Torah. R' Tzadok (Pri Tzadik, Terumah 1) notes the seeming contradiction: on the one hand, Hashem is immanent in the Torah; on the other hand, Hashem asks us to build a Mishkan for his presence, implying that he resides outside the bounds of the Torah itself. It seems to me that the ambiguity of the Midrash captures the tension between the divergent views of R' Chaim and the Besh"T. The relationship between Mishkan, the symbol of dveykus, and Torah, intellectual study, is not clearly spelled out by the Midrash, and is left for us to puzzle over.