You won't have a problem withYour plans are fine under the VWP rules you cited -- however, you may have another serious problem, seementioned. See below for issues about going to visit a fiancee.
The key wordsphrase you cited areis "as long as the trip does not terminatethe trip does not terminate in contiguous territory or an adjacent island". This is because the 90 days allowed under VWP may include any time you spend in continguous territories or adjacent islands after entering the US.
Allowed under VWP (what you asked about): UK to Mexico, Mexico to US, US back to Mexico, Mexico back to UK, all within 90 days and all tickets in hand.
Disallowed: UK to US, stay for 40 days, US to Mexico, stay in Mexico for 40 days, return to US and stay another 11 days. Disallowed because you would stay in the US past 90 days from the initial US entry.
Gray area: UK to US, stay for 40 days, US to Mexico, stay for 6 months. Gray area because it is unclear whether staying in Mexico for 6 months counts as terminating the trip there. Probably still acceptable as long as you already have tickets out of Mexico and can clearly explain your plans.
===
However, youYou also mentioned "to see my fiancee". This can be a seriouspotential problem because some US law impliesofficials (incorrectly) think that entering the US to see one's fiancee should only be done with a K-1 fiancee visa. Under (The K-1 fiancee visa assumes9 FAM 402.2-4(B)(1) you willshould be able to get married in the US and subsequently become a permanent resident. It is a lengthy process to say the least.) If you wanttourist visa to seevisit your fiancee but not get married on that triptemporarily, US immigration law does not really have an option forwhich implies that. Depending on how much you can tolerate the risk of serious US immigration problems (ie, how much do your future plans depend on US immigration), you might not want it should also be possible to seek entrydo so under VWP for. Here are some more resources about this purposeissue: 1, 2, 3.