Bottom line: Yes, ugly design can be good UX. In the end, it's a matter of knowing: 1) what your users want/need, 2) when to prioritize form to sacrifice function, 3) when to prioritize function to sacrifice form.
Can bad UI design have good UX?
Users may love the product with bad UI yet good UX because a smooth and intuitive customer experience prevails the interface beauty. It doesn't mean a pleasant interface won't influence users' attitudes to the product, though.