Adjectives, of course, modify nouns and pronouns. Adverbs, on the other hand, modify verbs, which describe motion or some form of action. For example, in the sentence, "the team is playing football," "playing" is the verb describing the action being taken by the noun, "the team." The word "ugly," used as an adverb, could be added to that sentence to describe the rather poor performance being witnessed by observers: "The team is playing ugly football," meaning the team is performing very poorly.
The word "ugly" has been used occasionally as an adverb to describe successful endeavors that nevertheless were poorly executed. One case involves the book Winning Ugly: NATO's War to Save Kosovo [Brookings Institution Press, 2000], about the successful military effort by the United States and its European allies to stop the fighting in a former province of the former country of Yugoslavia. While successful, the military operations were, according to the authors, poorly planned and executed and proved successful solely by virtue of the alliance's overwhelming strength.
Another example is Winning Ugly: Mental Warfare in Tennis [Touchstone, 2013], in which the author uses "ugly" as an adverb to describe his strategy for defeating more talented players with smoother, or "prettier" strokes.
Finally, the Rolling Stones song "Winning Ugly" includes the following lyrics: "And we're winning, winning ugly."
"Ugly" used as an adverb is used to describe action that is not pretty to look at, but which gets the job done.