I don't think there are many scenarios in which you can get a visa on arrival in the UK. Either you need a visa and you need to apply in advance, or you qualify for some exemption/concession and you are just exempted from the visa requirement without needing to pay a fee or to follow any particular procedure.
If for some reason the UK border force denies you the right to go landside but you are already in the airport under some visa exemption rule then I don't think there is any timely way to get a visa and I assume you have to spend the night there. It's probably the same thing if you are denied entry despite having a visa but I would expect this to be extremely uncommon.
Furthermore, the page on airside transit also mentions a 24 hours requirement for the DATV exemption (presumably to avoid having people stuck in the airport for too long), so it does indeed seem you will need a visa in any case. You will need to get it in advance to avoid being denied boarding in Chicago.
Finally, I would assume that the 48 hours requirement is also a sharp one, which would mean that your other flight option would not only require a “visitor in transit visa” but a (more expensive) short-term visit visa, no matter whether you want to stay airside or go landside.
Info on application process and fees when applying in the US (also note the “Apply for a visa online” in the top right corner).