sed '/^import Foo$/{x;/^$/!d;g;}'
How it works: On each line matching the pattern
* `x`: swap the line with the hold space
* `/^$/!d`: if what's just been fetched from hold space isn't empty, ie. because a previous match was stored there, delete the pattern and advance to the next line
* `g`: otherwise (ie. the first time through) copy the saved line back. It will be printed by default