you really need to get a report by mazda. you have the right to know what reasons they give for the decline of warranty as well as the determined cause of failure. there are circumstances where its totally unsafe and unacceptable to suddenly stop and pull over (i.e highway). the shop you took it too should have insurance to cover instances such as this (should they be found at fault)
heres what i would do. 1) get the final technician's report from your dealer stating the cause of failure and reason why it was declined for warranty. 2) get a second opinion, mazda is going to be partial, replacing an engine is basically the most expensive warranty work there is so if there is any time that they will fight it would be now. 3) after this you should be able to tell who is truly at fault, you, mazda or the shop. with that info is when you decide to a) go back to mazda and fight, b) go back to shop and fight, or c) hire attorney to do either a or b for you or advise in your best interest. this is a big expense and if i truly believed i was not at fault i'd do everything i could to get this situation resolved appropriately.