Is it ethical to slightly improve upon someone's unpublished work posted in arxiv and publish before the original work? Is it ethical to slightly improve upon someone's work posted in arxiv and publish before the original work, however citing the original work? 

I mean suppose the original work gets rejected in a top-tier journal (generally top-tier journal takes so much time) whereas the improved version gets accepted in a mediocre journal (suppose the mediocre journal is fast in reviewing). 

Then what should the author of the original work (I am the author of the original work) should do?
I question, as did Dan Romik, your characterization of work posted on arXiv as 'unpublished': it is made available to what amounts to the widest possible public, it is just an un-refereed publication (or perhaps arguably a kind-of very slightly refereed one, if you read the conditions). 

I suggest that the ethics of it depend on whether the later-published paper  acknowledged the arXiv paper as earlier work, or not. If it did, I see no problem.  

If the later paper made no acknowledgement, then maybe there is a problem if its editor/referee(s) happened not to spot the earlier paper in arXiv and took the whole content of the later author as original. 

But what the arXiv author could do in that event I could not begin to suggest. Best response would probably depend highly on the particular circumstances, which would no doubt be awkward to set out in this medium.