For example, it is impressive how much code can be simplified by just using the correct API calls. Also, some language features are explicitly designed to address a specific problem, and yet they stay unused, even when the problem arises.
As for your two points.
- If you forget about how it works in an hour, you never knew how it worked in the first place. It can happen when you write code at random and tweak it until it passes the test. IMHO, that's the opposite of a clever hack.
- I love to see clever hacks in code I maintain. Like everyone else I start going "WTF?!" but a few minutes later, it usually turns into "oh nice, I learned something today".
To illustrate, this is the kind of code I like to read https://www.youtube.com/user/Bisqwit . This guy's code is short, clever, takes advantage of everything the language has to offer, and still manages not to be too cryptic. Note that these are educational videos and the author spends a lot of time to get to that level. I don't expect to see that in a typical project, but that's kind of an ideal for me.
Obviously I disagree. I'll have forgotten through a combination of being old, not being interested in that code any more, having spent an hour doing something else, and work not being important enough to take up rent-free space in my brain.
It wasn't a hack, so much as removing someone elses (unnecessary) hack that fixed the problem.
Presumably this was a trivial data dump and not something like a report that could have benefited from, e.g., embedded formulas, multiple sheets, etc.? (I've produced exports with the latter and the enhancements were greatly appreciated over the plain old CSV export.)
I've been in similar situations and, invariably, the "few lines of code" is inscrutable nonsense that no-one else will be able to maintain (and often even understand.) I can write obtuse one line "clever" hacks to solve problems but I'm keenly aware that a) I'll have forgotten how it works in an hour and b) some poor bastard (which might well be me) will have to maintain it for N years after I'm gone.