You're OK in both directions. On the return from DEL, no guarantees it will be hassle-free, especially if MU outsources the check-in staff. All you can do is bring your itinerary, TIMATIC printout might help (use the interface on Delta's website as it's easier), and get to check-in early so there's time to argue the point if necessary). Don't get into arguments on the "leaving the airport" part. If they insist that they'll let you board but you'll have to stay inside the airport for 45 hours, just smile, do a "Yes massa" thing, and fly.
Of course, we (and now you) know better, and when you get to Shanghai and immigration, you'll get your transit stamp at Immigration and your 48 hour maximum stay.
You will be free to go to Hangzhou for a daytrip. You will need your passport to buy a train ticket, but they only look at the front photo page for the passport number to enter into the computer and print out the ticket. It may be a bit trickier to book a hotel in Hangzhou for the night rather than Shanghai, as check-in process requires the hotel staff to examine and copy your visa (or transit stamp) and send it off to the Public Security Bureau (PSB). Note that the PSB has been known to do some spot checks of foreigners on 48-hour TWOV allowances via their hotels....to see if they are actually staying at the hotel put down on the Immigration arrival card.